This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

String class

String Class

Members


String ()

Default constructor that creates an empty string.

String (const String & s)

Copy constructor.

Arguments

  • const String & s - String to be copied.

String (const char * s)

Explicit constructor.

Arguments

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

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.

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.

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, char c)

Appends the symbol.

Arguments

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

void append (char c)

Appends the symbol.

Arguments

  • char c - The symbol to append.

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 (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 (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.

String & operator+= (const String & s)

String addition.

Arguments

  • const String & s - The second string.

Return value

String & operator+= (const char * s)

Symbol addition.

Arguments

  • const char * s - The symbol.

Return value

String & operator+= (char c)

Symbol addition.

Arguments

  • char c - The symbol.

Return value

String & operator= (const char * s)

Assignment operator for the string.

Arguments

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

Return value

String & operator= (const String & s)

Assignment operator for the string.

Arguments

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

Return value

char & operator[] (int index)

Array access.

Arguments

  • int index - Array item index.

Return value

The array item.

char operator[] (int index)

Constant array access.

Arguments

  • int index - Array item index.

Return value

The array item.

int getInt ()

Returns the current string as a integer value.

Return value

The value of the variable.

float getFloat ()

Returns the current string as a float value.

Return value

The value of the variable.

double getDouble ()

Returns the current string as a double value.

Return value

The value of the variable.

long long getLong ()

Returns the current string as a long long value.

Return value

The value of the variable.

String substr (int pos, int size)

Returns the sub-string.

Arguments

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

Return value

Sub-string string.

String trim (const char * symbols)

Removes the specified symbols from the beginning and the ending.

Arguments

  • const char * symbols - Symbols to remove.

Return value

The string.

String dirname ()

Returns directory name.

Return value

The string.

String format (const char * format)

Arguments

  • const char * format

Return value

String memory (size_t memory)

Returns memory amount string.

Arguments

  • size_t memory - Amount of memory.

Return value

String representation.

int utf8ToUnicode (wchar_t * dest, int size)

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 symbols.

Return value

Length of the wide-character string.

int utf8ToUnicode (unsigned int * dest, int size)

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 symbols.

Return value

String utf8substr (int pos, int size)

Returns the wide-character sub-string.

Arguments

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

Return value

Sub-string string.

int utf8strlen ()

Returns the wide-character length of string.

Return value

Length of the wide-character string.

int size ()

Returns the size of the string.

Return value

The size of the string.

void clear ()

Clears the string.

String format (const char * format, va_list argptr)

Returns a formatted string. A format string is composed of zero or more ordinary characters (excluding %) that are copied directly to the result string and control sequences, each of which results in fetching its own parameter. Each control sequence consists of a percent sign (%) followed by one or more of these elements, in order:
  • An optional number, a width specifier, that says how many characters (minimum) this conversion should result in.
  • An optional precision specifier that says how many decimal digits should be displayed for floating-point numbers.
  • A type specifier that says what type the argument data should be treated as. Possible types:
    • c: the argument is treated as an integer and presented as a character with that ASCII value.
    • d or i: the argument is treated as an integer and presented as a (signed) decimal number.
    • o: the argument is treated as an integer and presented as an octal number.
    • u: the argument is treated as an integer and presented as an unsigned decimal number.
    • x: the argument is treated as an integer and presented as a hexadecimal number (with lowercase letters).
    • X: the argument is treated as an integer and presented as a hexadecimal number (with uppercase letters).
    • f: the argument is treated as a float and presented as a floating-point number.
    • g: the same as e or f, the shortest one is selected.
    • G: the same as E or F, the shortest one is selected.
    • e: the argument is treated as using the scientific notation with lowercase 'e' (e.g. 1.2e+2).
    • E: the argument is treated as using the scientific notation with uppercase 'E' (e.g. 1.2E+2).
    • s: the argument is treated as and presented as a string.
    • p: the argument is treated as and presented as a pointer address.
    • %: a literal percent character. No argument is required.

Arguments

  • const char * format - Format string.
  • va_list argptr - Arguments pointer.

Return value

The formatted string.

void printf (const char * format, ...)

Initializes a formatted string.

Arguments

  • const char * format - Format string.
  • ... - Arguments, multiple allowed.

void vprintf (const char * format, va_list argptr)

Initializes a formatted string.

Arguments

  • const char * format - Format string.
  • va_list argptr - Arguments pointer.

int scanf (const char * format, ...)

Scans a formatted string.

Arguments

  • const char * format - Format string.
  • ... - Arguments, multiple allowed.

Return value

int vscanf (const char * format, va_list argptr)

Scans a formatted string.

Arguments

  • const char * format - Format string.
  • va_list argptr - Arguments pointer.

Return value

String pathname ()

Returns directory name.

Return value

Directory name.

void destroy ()

Destroys the string.

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

Replaces one string to another.

Arguments

  • const char * before - String before.
  • const char * after - String after.

Return value

The string.

int empty ()

Returns an empty flag.

Return value

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

const char * get ()

Returns the pointer to the null-terminated string.

Return value

The null-terminated string.

String basename ()

Returns file name.

Return value

The string.

String extension ()

Returns extension name.

Return value

Extension name.

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.
Last update: 2017-07-03
Build: ()