|
| string () |
| Default constructor.
|
|
| string (const string< T, TAlloc > &other) |
| Constructor.
|
|
template<class B , class A > |
| string (const string< B, A > &other) |
| Constructor from other string types.
|
|
| string (const double number) |
| Constructs a string from a float.
|
|
| string (int number) |
| Constructs a string from an int.
|
|
| string (unsigned int number) |
| Constructs a string from an unsigned int.
|
|
| string (long number) |
| Constructs a string from a long.
|
|
| string (unsigned long number) |
| Constructs a string from an unsigned long.
|
|
template<class B > |
| string (const B *const c, u32 length) |
| Constructor for copying a string from a pointer with a given length.
|
|
template<class B > |
| string (const B *const c) |
| Constructor for Unicode and ASCII strings.
|
|
| ~string () |
| Destructor.
|
|
string< T, TAlloc > & | operator= (const string< T, TAlloc > &other) |
| Assignment operator.
|
|
template<class B , class A > |
string< T, TAlloc > & | operator= (const string< B, A > &other) |
| Assignment operator for other string types.
|
|
template<class B > |
string< T, TAlloc > & | operator= (const B *const c) |
| Assignment operator for strings, ASCII and Unicode.
|
|
string< T, TAlloc > | operator+ (const string< T, TAlloc > &other) const |
| Append operator for other strings.
|
|
template<class B > |
string< T, TAlloc > | operator+ (const B *const c) const |
| Append operator for strings, ASCII and Unicode.
|
|
T & | operator[] (const u32 index) |
| Direct access operator.
|
|
const T & | operator[] (const u32 index) const |
| Direct access operator.
|
|
bool | operator== (const T *const str) const |
| Equality operator.
|
|
bool | operator== (const string< T, TAlloc > &other) const |
| Equality operator.
|
|
bool | operator< (const string< T, TAlloc > &other) const |
| Is smaller comparator.
|
|
bool | operator!= (const T *const str) const |
| Inequality operator.
|
|
bool | operator!= (const string< T, TAlloc > &other) const |
| Inequality operator.
|
|
u32 | size () const |
| Returns length of the string's content.
|
|
bool | empty () const |
|
void | clear (bool releaseMemory=true) |
|
const T * | data () const |
| Returns character string.
|
|
string< T, TAlloc > & | make_lower () |
| Makes the string lower case.
|
|
string< T, TAlloc > & | make_upper () |
| Makes the string upper case.
|
|
bool | equals_ignore_case (const string< T, TAlloc > &other) const |
| Compares the strings ignoring case.
|
|
bool | equals_substring_ignore_case (const string< T, TAlloc > &other, const s32 sourcePos=0) const |
| Compares the strings ignoring case.
|
|
bool | lower_ignore_case (const string< T, TAlloc > &other) const |
| Compares the strings ignoring case.
|
|
bool | equalsn (const string< T, TAlloc > &other, u32 n) const |
| compares the first n characters of the strings
|
|
bool | equalsn (const T *const str, u32 n) const |
| compares the first n characters of the strings
|
|
string< T, TAlloc > & | append (T character) |
| Appends a character to this string.
|
|
string< T, TAlloc > & | append (const T *const other, u32 length=0xffffffff) |
| Appends a char string to this string.
|
|
string< T, TAlloc > & | append (const string< T, TAlloc > &other) |
| Appends a string to this string.
|
|
string< T, TAlloc > & | append (const string< T, TAlloc > &other, u32 length) |
| Appends a string of the length l to this string.
|
|
string< T, TAlloc > & | insert (u32 pos, const char *s, u32 n) |
| Insert a certain amount of characters into the string before the given index.
|
|
void | reserve (u32 count) |
| Reserves some memory.
|
|
s32 | findFirst (T c) const |
| finds first occurrence of character in string
|
|
s32 | findFirstChar (const T *const c, u32 count=1) const |
| finds first occurrence of a character of a list in string
|
|
template<class B > |
s32 | findFirstCharNotInList (const B *const c, u32 count=1) const |
| Finds first position of a character not in a given list.
|
|
template<class B > |
s32 | findLastCharNotInList (const B *const c, u32 count=1) const |
| Finds last position of a character not in a given list.
|
|
s32 | findNext (T c, u32 startPos) const |
| finds next occurrence of character in string
|
|
s32 | findLast (T c, s32 start=-1) const |
| finds last occurrence of character in string
|
|
s32 | findLastChar (const T *const c, u32 count=1) const |
| finds last occurrence of a character of a list in string
|
|
template<class B > |
s32 | find (const B *const str, const u32 start=0) const |
| finds another string in this string
|
|
string< T > | subString (u32 begin, s32 length, bool make_lower=false) const |
| Returns a substring.
|
|
string< T, TAlloc > & | operator+= (T c) |
| Appends a character to this string.
|
|
string< T, TAlloc > & | operator+= (const T *const c) |
| Appends a char string to this string.
|
|
string< T, TAlloc > & | operator+= (const string< T, TAlloc > &other) |
| Appends a string to this string.
|
|
string< T, TAlloc > & | operator+= (const int i) |
| Appends a string representation of a number to this string.
|
|
string< T, TAlloc > & | operator+= (const unsigned int i) |
| Appends a string representation of a number to this string.
|
|
string< T, TAlloc > & | operator+= (const long i) |
| Appends a string representation of a number to this string.
|
|
string< T, TAlloc > & | operator+= (const unsigned long i) |
| Appends a string representation of a number to this string.
|
|
string< T, TAlloc > & | operator+= (const double i) |
| Appends a string representation of a number to this string.
|
|
string< T, TAlloc > & | operator+= (const float i) |
| Appends a string representation of a number to this string.
|
|
string< T, TAlloc > & | replace (T toReplace, T replaceWith) |
| Replaces all characters of a special type with another one.
|
|
string< T, TAlloc > & | replace (const string< T, TAlloc > &toReplace, const string< T, TAlloc > &replaceWith) |
| Replaces all instances of a string with another one.
|
|
string< T, TAlloc > & | remove (T c) |
| Removes characters from a string.
|
|
string< T, TAlloc > & | remove (const string< T, TAlloc > &toRemove) |
| Removes a string from the string.
|
|
string< T, TAlloc > & | removeChars (const string< T, TAlloc > &characters) |
| Removes characters from a string.
|
|
string< T, TAlloc > & | trim (const string< T, TAlloc > &whitespace=" \t\n\r") |
| Trims the string.
|
|
string< T, TAlloc > & | eraseTrailingFloatZeros (char decimalPoint='.') |
| Erase 0's at the end when a string ends with a floating point number.
|
|
string< T, TAlloc > & | erase (u32 index) |
| Erases a character from the string.
|
|
string< T, TAlloc > & | validate () |
| verify the existing string.
|
|
T | lastChar () const |
| gets the last char of a string or null
|
|
template<class container > |
u32 | split (container &ret, const T *const delimiter, u32 countDelimiters=1, bool ignoreEmptyTokens=true, bool keepSeparators=false) const |
| Split string into parts (tokens).
|
|
Very simple string class with some useful features.
string<c8> and string<wchar_t> both accept Unicode AND ASCII/Latin-1, so you can assign Unicode to string<c8> and ASCII/Latin-1 to string<wchar_t> (and the other way round) if you want to.
However, note that the conversation between both is not done using any encoding. This means that c8 strings are treated as ASCII/Latin-1, not UTF-8, and are simply expanded to the equivalent wchar_t, while Unicode/wchar_t characters are truncated to 8-bit ASCII/Latin-1 characters, discarding all other information in the wchar_t.
Helper functions for converting between UTF-8 and wchar_t are provided outside the string class for explicit use.