This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
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

Header:#include <UnigineString.h>

Provides an interface to work with input and output data packed into internal (not C++ standard) String class.

For example, Unigine::String class can be used when you pass the data from UnigineScript to C++.

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(String && s)

Arguments

  • String && s

const char * get()

Returns the pointer to the null-terminated string.

Return value

The null-terminated string.

char get(int index)

Arguments

  • int index

char & get(int index)

Arguments

  • int index

int isalpha(int code)

Arguments

  • int code

int isdigit(int code)

Arguments

  • int code

double getDouble()

Returns the current string as a double 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.

int getInt()

Returns the current string as a integer 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.

int islower(int code)

Arguments

  • int code

int isspace(int code)

Arguments

  • int code

int isupper(int code)

Arguments

  • int code

StringStack<> absname(const char * path, const char * str)

Arguments

  • const char * path
  • const char * str

StringStack<> addslashes(const char * str)

Arguments

  • const char * str

void allocate(int size)

Arguments

  • int size

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

Appends a given string to the end of the string.

Arguments

  • const String & s - String to append.
  • int size - Length of the string to be appended.

Return value

Resulting string.

String & append(char c)

Appends a given symbol to the end of the string.

Arguments

  • char c - Symbol to append.

Return value

Resulting string.

String & append(int pos, char c)

Inserts a given symbol at the specified position.

Arguments

  • int pos - Insertion position.
  • char c - Symbol to insert.

Return value

Resulting string.

String & append(const char * s, int size)

Appends a given null-terminated string to the end of the string.

Arguments

  • const char * s - Null-terminated string to append.
  • int size - Length of the null-terminated string to be appended.

Return value

Resulting string.

String & append(int pos, const char * s, int size)

Inserts a given null-terminated string at the specified position.

Arguments

  • int pos - Insertion position.
  • const char * s - Null-terminated string to insert.
  • int size - Length of the null-terminated string to be inserted.

Return value

Resulting string.

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

Inserts a given string at the specified position.

Arguments

  • int pos - Insertion position.
  • const String & s - String to insert.
  • int size - Length of the string to be inserted.

Return value

Resulting string.

double atod(const char * str)

Arguments

  • const char * str

float atof(const char * str)

Arguments

  • const char * str

int atoi(const char * str)

Arguments

  • const char * str

long long atol(const char * str)

Arguments

  • const char * str

String basename()

Returns file name.

Return value

The string.

StringStack<> basename(const char * str)

Arguments

  • const char * str

void clear()

Clears the string.

int contains(const char * s, int case_sensitive)

Arguments

  • const char * s
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

int contains(const String & s, int case_sensitive)

Arguments

  • const String & s
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

int contains(char c, int case_sensitive)

Arguments

  • char c
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

void copy(const char * s, int size)

Arguments

  • const char * s
  • int size

void copy(const String & s, int size)

Arguments

  • const String & s
  • int size

void destroy()

Destroys the string.

String dirname()

Returns directory name.

Return value

The string.

StringStack<> dirname(const char * str)

Arguments

  • const char * str

void do_append(char c)

Arguments

  • char c

void do_append(int pos, char c)

Arguments

  • int pos
  • char c

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

Arguments

  • int pos
  • const char * s
  • int size

void do_append(const char * s, int size)

Arguments

  • const char * s
  • int size

void do_copy(const char * s, int size)

Arguments

  • const char * s
  • int size

void do_memcpy(char * dest, const char * src, int size)

Arguments

  • char * dest
  • const char * src
  • int size

StringStack<> dtoa(double value, int precision, int use_inf)

Arguments

  • double value
  • int precision
  • int use_inf

int empty()

Returns an empty flag.

Return value

1 if the string is empty; otherwise, 0.

int endsWith(const char * s, int case_sensitive, int size)

Arguments

  • const char * s
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.
  • int size

int endsWith(const String & s, int case_sensitive, int size)

Arguments

  • const String & s
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.
  • int size

int endsWith(const char * data, const char * str, int case_sensitive, int data_size, int str_size)

Arguments

  • const char * data
  • const char * str
  • int case_sensitive
  • int data_size
  • int str_size

String extension()

Returns extension name.

Return value

Extension name.

StringStack<> extension(const char * str)

Arguments

  • const char * str

StringStack<> extension(const char * str, const char * ext)

Arguments

  • const char * str
  • const char * ext

String filename()

StringStack<> filename(const char * str)

Arguments

  • const char * str

int find(char c, int case_sensitive)

Arguments

  • char c
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

int find(const String & s, int case_sensitive)

Arguments

  • const String & s
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

int find(const char * s, int case_sensitive)

Arguments

  • const char * s
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

char first()

char & first()

StringStack<> format(const char * format, va_list argptr)

Returns a stack of formatted strings. 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

Stack of formated strings.

StringStack<> format(const char * format)

Returns a stack of formatted strings. 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.

Return value

Stack of formated strings.

StringStack<> ftoa(float value, int precision)

Arguments

  • float value
  • int precision

int grow_to(int new_length)

Arguments

  • int new_length

unsigned int hash(const char * str, int size)

Arguments

  • const char * str
  • int size

StringStack<> itoa(int value, int radix)

Arguments

  • int value
  • int radix

StringStack<> joinPaths(const char * p0, const char * p1)

Arguments

  • const char * p0
  • const char * p1

char last()

char & last()

String & lower()

StringStack<> ltoa(long long value, int radix)

Arguments

  • long long value
  • int radix

int match(const char * pattern, const char * str)

Arguments

  • const char * pattern
  • const char * str

StringStack<> memory(size_t memory)

Returns a stack of strings containing information on memory consumption for the string.

Arguments

  • size_t memory - Amount of memory.

Return value

Stack of strings containing information on memory consumption for the string.

StringStack<> normalizeDirPath(const char * path)

Arguments

  • const char * path

StringStack<> normalizePath(const char * path)

Arguments

  • const char * path

const char * operator const char *()

const void * operator const void *()

String & operator+=(const String & s)

String addition.

Arguments

  • const String & s - The second string.

String & operator+=(const char * s)

Symbol addition.

Arguments

  • const char * s - The symbol.

String & operator+=(char c)

Symbol addition.

Arguments

  • char c - The symbol.

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=(String && s)

Arguments

  • String && s

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.

String pathname()

Returns directory name.

Return value

Directory name.

StringStack<> pathname(const char * str)

Arguments

  • const char * str

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

Initializes a formatted string.

Arguments

  • const char * format - Format string.

StringStack<> relname(const char * path, const char * str)

Arguments

  • const char * path
  • const char * str

String & remove()

Removes the last symbol of the string.

Return value

Resulting string.

String & remove(int pos, int size)

Removes the specified number of symbols at the given position from the string.

Arguments

  • int pos - Position.
  • int size - Number of symbols to remove.

Return value

Resulting string.

StringStack<> removeExtension(const char * str)

Arguments

  • const char * str

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

Replaces all occurrences of a substring with the specified new string.

Arguments

  • const char * before - String to be replaced.
  • const char * after - String to replace the old one.
  • int case_sensitive - Case sensitivity flag. If set to 1, the replacement is case-sensitive; otherwise case is ignored.

StringStack<> replace(const char * str, const char * before, const char * after, int case_sensitive)

Arguments

  • const char * str
  • const char * before
  • const char * after
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

StringStack<> replace(const char * str, char before, char after, int case_sensitive)

Arguments

  • const char * str
  • char before
  • char after
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

String replace(char before, char after, int case_sensitive)

Arguments

  • char before
  • char after
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

void reserve(int size)

Arguments

  • int size

void resize(int size)

Arguments

  • int size

void reverse_utf8_bidirectional(char * str)

Arguments

  • char * str

void reverseUtf8BiDirectional(String & string)

Arguments

  • String & string

int rfind(const String & s, int case_sensitive)

Arguments

  • const String & s
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

int rfind(char c, int case_sensitive)

Arguments

  • char c
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

int rfind(const char * s, int case_sensitive)

Arguments

  • const char * s
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.

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

Scans a formatted string.

Arguments

  • const char * format - Format string.

Return value

Number of arguments successfully read, or EOF if failure occurs.

void shrink()

int size()

Returns the size of the string.

Return value

The size of the string.

int space()

StringArray<> split(const char * str, const char * delimiters)

Arguments

  • const char * str
  • const char * delimiters

int sscanf(const char * str, const char * format)

Arguments

  • const char * str
  • const char * format

int startsWith(const char * data, const char * str, int case_sensitive, int data_size, int str_size)

Arguments

  • const char * data
  • const char * str
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.
  • int data_size
  • int str_size

int startsWith(const String & s, int case_sensitive, int size)

Arguments

  • const String & s
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.
  • int size

int startsWith(const char * s, int case_sensitive, int size)

Arguments

  • const char * s
  • int case_sensitive - Case sensitivity flag. If set to 1, the operation is case-sensitive; otherwise case is ignored.
  • int size

StringStack<> stripslashes(const char * str)

Arguments

  • const char * str

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.

StringStack<> substr(const char * str, int pos, int size)

Arguments

  • const char * str
  • int pos
  • int size

StringStack<> substr(const String & str, int pos, int size)

Arguments

  • const String & str
  • int pos
  • int size

char toLower(char c)

Arguments

  • char c

char toUpper(char c)

Arguments

  • char c

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.

StringStack<> trim(const char * str, const char * symbols)

Arguments

  • const char * str
  • const char * symbols

String trimFirst(const char * symbols)

Arguments

  • const char * symbols

StringStack<> trimFirst(const char * str, const char * symbols)

Arguments

  • const char * str
  • const char * symbols

String trimLast(const char * symbols)

Arguments

  • const char * symbols

StringStack<> trimLast(const char * str, const char * symbols)

Arguments

  • const char * str
  • const char * symbols

String::Direction unicodeGetDirection(unsigned int code)

Arguments

  • unsigned int code

int unicodeToUtf8(unsigned int code, char * dest)

Arguments

  • unsigned int code
  • char * dest

StringStack<> unicodeToUtf8(const wchar_t * src)

Arguments

  • const wchar_t * src

StringStack<> unicodeToUtf8(const unsigned int * src)

Arguments

  • const unsigned int * src

StringStack<> unicodeToUtf8(unsigned int code)

Arguments

  • unsigned int code

String & upper()

int utf8strlen()

Returns the wide-character length of string.

Return value

Length of the wide-character string.

int utf8strlen(const char * str)

Arguments

  • const char * str

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.

StringStack<> utf8substr(const char * str, int pos, int size)

Arguments

  • const char * str
  • int pos
  • int size

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.

int utf8ToUnicode(const char * src, wchar_t * dest, int size)

Arguments

  • const char * src
  • wchar_t * dest
  • int size

int utf8ToUnicode(const char * src, unsigned int & code)

Arguments

  • const char * src
  • unsigned int & code

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

Arguments

  • const char * src
  • unsigned int * dest
  • int size

void vprintf(const char * format, va_list argptr)

Initializes a formatted string.

Arguments

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

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

Number of arguments successfully read, or EOF if failure occurs.

int vsscanf(const char * str, const char * format, va_list argptr)

Arguments

  • const char * str
  • const char * format
  • va_list argptr

int compare(const char * str0, const char * str1)

Arguments

  • const char * str0
  • const char * str1

int null

Description

Null string.
Last update: 2018-08-10
Build: ()