This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine::String Class

String class.

To use this class, include the UnigineString.h file.

Unigine::String Class

Members


String ()

Default constructor that creates an empty string.

String (const String & s)

Copy constructor.

Arguments

  • const String & s - String.

explicit String (const char * s)

Explicit constructor.

Arguments

  • const char * s - Pointer to the null-terminated string.

explicit String (const wchar_t * s)

Explicit constructor for a wide-character string.

Arguments

  • const wchar_t * s - Pointer to the wide-character null-terminated string.

explicit String (const unsigned int * s)

Explicit constructor for a wide-character string.

Arguments

  • const unsigned int * s - Pointer to the wide-character null-terminated string.

~String ()

Destructor.

UNIGINE_INLINE const char * get () const

Returns the pointer to the null-terminated string.

Return value

The null-terminated string.

UNIGINE_INLINE int size () const

Returns the size of the string.

Return value

The size of the string.

UNIGINE_INLINE int empty () const

Returns the 1 if the string is empty; otherwise, 0 is returned.

Return value

The empty flag.

void clear ()

Clears the string.

void append (char c)

Appends the symbol.

Arguments

  • char c - The symbol

void append (const char * s, int size)

Appends the string.

Arguments

  • const char * s - The null-terminated string to append.
  • int size - The length of the string.

void append (const String & s, int size)

Appends the string.

Arguments

  • const String & s - The source string to append.
  • int size - The length of the string.

void append (int pos, char c)

Appends the symbol.

Arguments

  • int pos - Insertion position.
  • char c - The symbol

void append (int pos, const char * s, int size)

Appends the string.

Arguments

  • int pos - Insertion position.
  • const char * s - The null-terminated string to append.
  • int size - The length of the string.

void append (int pos, const String & s, int size)

Inserts the string at the given position.

Arguments

  • int pos - Insertion position.
  • const String & s - The source string to insert.
  • int size - The length of the string.

void remove ()

Removes the last symbol of the string.

void remove (int pos, int size)

Removes symbols at the given position from the string.

Arguments

  • int pos - Removal position.
  • int size - The number of symbols to remove.

void vprintf (const char * format, va_list argptr)

Initializes a formatted string.

Arguments

  • const char * format - String format.
  • va_list argptr - Arguments pointer.

void printf ()

void int vscanf (const char * format, va_list argptr)

Scans a formatted string.

Arguments

  • const char * format - String format.
  • va_list argptr - Arguments pointer.

int scanf ()

String String trim (const char * symbols) const

Removes the specified symbols from the beginning and the ending.

Arguments

  • const char * symbols - Symbols to remove.

Return value

The string.

String replace (const char * before, const char * after) const

Replaces one string to another.

Arguments

  • const char * before - The before string.
  • const char * after - The after string.

Return value

The string.

String substr (int pos, int size) const

Return the sub-string.

Arguments

  • int pos - Starting position.
  • int size - Sub-string length.

Return value

Sub-string string.

String basename () const

Return file name.

Return value

The string.

String pathname () const

Return directory name.

Return value

The string.

int utf8ToUnicode (wchar_t * dest, int size) const

Converts a string into the wide-character string.

Arguments

  • wchar_t * dest - Pointer to the wide-character string.
  • int size - Size of wide-character string in simbols.

Return value

Length of the wide-character string.

int utf8ToUnicode (unsigned int * dest, int size) const

Converts a string into the wide-character string.

Arguments

  • unsigned int * dest - Pointer to the wide-character string.
  • int size - Size of wide-character string in simbols.

Return value

Length of the wide-character string.

int utf8strlen () const

Return the wide-character length of string.

Return value

Length of the wide-character string.

String utf8substr (int pos, int size) const

Return the wide-character sub-string.

Arguments

  • int pos - Starting position.
  • int size - Sub-string length.

Return value

Sub-string string.

int getInt () const

Return the current string as a integer value.

Return value

The value of the variable.

long long getLong () const

Return the current string as a long long value.

Return value

The value of the variable.

float getFloat () const

Return the current string as a float value.

Return value

The value of the variable.

double getDouble () const

Return the current string as a double value.

Return value

The value of the variable.

String & operator= (const char * s)

Assignment operator for the string.

Arguments

  • const char * s - The null-terminated string.

String & operator= (const String & s)

Assignment operator for the string.

Arguments

  • const String & s - The value of the string.

String & operator+= (char c)

Symbol addition.

Arguments

  • char c - The symbol.

String & operator+= (const char * s)

String addition.

Arguments

  • const char * s - The null-terminated string.

String & operator+= (const String & s)

String addition.

Arguments

  • const String & s - The second string.

UNIGINE_INLINE char & operator[] (int index)

Array access.

Arguments

  • int index - Array item index.

Return value

The array item.

UNIGINE_INLINE char operator[] (int index) const

Constant array access.

Arguments

  • int index - Array item index.

Return value

The array item.

static int static String format (const char * format, va_list argptr)

Returns a formatted string.

Arguments

  • const char * format - String format.
  • va_list argptr - Arguments pointer.

Return value

The formatted string.

static String format ()

Last update: 2017-07-03
Build: ()