Irrlicht 3D Engine
irr::core::string< T, TAlloc > Class Template Reference

Very simple string class with some useful features. More...

#include <irrString.h>

Public Types

typedef T char_type
 

Public Member Functions

 string ()
 Default constructor. More...
 
 string (const string< T, TAlloc > &other)
 Constructor. More...
 
template<class B , class A >
 string (const string< B, A > &other)
 Constructor from other string types. More...
 
 string (const double number)
 Constructs a string from a float. More...
 
 string (int number)
 Constructs a string from an int. More...
 
 string (unsigned int number)
 Constructs a string from an unsigned int. More...
 
 string (long number)
 Constructs a string from a long. More...
 
 string (unsigned long number)
 Constructs a string from an unsigned long. More...
 
template<class B >
 string (const B *const c, u32 length)
 Constructor for copying a string from a pointer with a given length. More...
 
template<class B >
 string (const B *const c)
 Constructor for Unicode and ASCII strings. More...
 
 ~string ()
 Destructor. More...
 
string< T, TAlloc > & append (T character)
 Appends a character to this string. More...
 
string< T, TAlloc > & append (const T *const other, u32 length=0xffffffff)
 Appends a char string to this string. More...
 
string< T, TAlloc > & append (const string< T, TAlloc > &other)
 Appends a string to this string. More...
 
string< T, TAlloc > & append (const string< T, TAlloc > &other, u32 length)
 Appends a string of the length l to this string. More...
 
const T * c_str () const
 Returns character string. More...
 
void clear (bool releaseMemory=true)
 
bool empty () const
 
bool equals_ignore_case (const string< T, TAlloc > &other) const
 Compares the strings ignoring case. More...
 
bool equals_substring_ignore_case (const string< T, TAlloc > &other, const s32 sourcePos=0) const
 Compares the strings ignoring case. More...
 
bool equalsn (const string< T, TAlloc > &other, u32 n) const
 compares the first n characters of the strings More...
 
bool equalsn (const T *const str, u32 n) const
 compares the first n characters of the strings More...
 
string< T, TAlloc > & erase (u32 index)
 Erases a character from the string. More...
 
string< T, TAlloc > & eraseTrailingFloatZeros (char decimalPoint='.')
 Erase 0's at the end when a string ends with a floating point number. More...
 
template<class B >
s32 find (const B *const str, const u32 start=0) const
 finds another string in this string More...
 
s32 findFirst (T c) const
 finds first occurrence of character in string More...
 
s32 findFirstChar (const T *const c, u32 count=1) const
 finds first occurrence of a character of a list in string More...
 
template<class B >
s32 findFirstCharNotInList (const B *const c, u32 count=1) const
 Finds first position of a character not in a given list. More...
 
s32 findLast (T c, s32 start=-1) const
 finds last occurrence of character in string More...
 
s32 findLastChar (const T *const c, u32 count=1) const
 finds last occurrence of a character of a list in string More...
 
template<class B >
s32 findLastCharNotInList (const B *const c, u32 count=1) const
 Finds last position of a character not in a given list. More...
 
s32 findNext (T c, u32 startPos) const
 finds next occurrence of character in string More...
 
string< T, TAlloc > & insert (u32 pos, const char *s, u32 n)
 Insert a certain amount of characters into the string before the given index. More...
 
lastChar () const
 gets the last char of a string or null More...
 
bool lower_ignore_case (const string< T, TAlloc > &other) const
 Compares the strings ignoring case. More...
 
string< T, TAlloc > & make_lower ()
 Makes the string lower case. More...
 
string< T, TAlloc > & make_upper ()
 Makes the string upper case. More...
 
T & operator [] (const u32 index)
 Direct access operator. More...
 
const T & operator [] (const u32 index) const
 Direct access operator. More...
 
bool operator!= (const T *const str) const
 Inequality operator. More...
 
bool operator!= (const string< T, TAlloc > &other) const
 Inequality operator. More...
 
string< T, TAlloc > operator+ (const string< T, TAlloc > &other) const
 Append operator for other strings. More...
 
template<class B >
string< T, TAlloc > operator+ (const B *const c) const
 Append operator for strings, ASCII and Unicode. More...
 
string< T, TAlloc > & operator+= (T c)
 Appends a character to this string. More...
 
string< T, TAlloc > & operator+= (const T *const c)
 Appends a char string to this string. More...
 
string< T, TAlloc > & operator+= (const string< T, TAlloc > &other)
 Appends a string to this string. More...
 
string< T, TAlloc > & operator+= (const int i)
 Appends a string representation of a number to this string. More...
 
string< T, TAlloc > & operator+= (const unsigned int i)
 Appends a string representation of a number to this string. More...
 
string< T, TAlloc > & operator+= (const long i)
 Appends a string representation of a number to this string. More...
 
string< T, TAlloc > & operator+= (const unsigned long i)
 Appends a string representation of a number to this string. More...
 
string< T, TAlloc > & operator+= (const double i)
 Appends a string representation of a number to this string. More...
 
string< T, TAlloc > & operator+= (const float i)
 Appends a string representation of a number to this string. More...
 
bool operator< (const string< T, TAlloc > &other) const
 Is smaller comparator. More...
 
string< T, TAlloc > & operator= (const string< T, TAlloc > &other)
 Assignment operator. More...
 
template<class B , class A >
string< T, TAlloc > & operator= (const string< B, A > &other)
 Assignment operator for other string types. More...
 
template<class B >
string< T, TAlloc > & operator= (const B *const c)
 Assignment operator for strings, ASCII and Unicode. More...
 
bool operator== (const T *const str) const
 Equality operator. More...
 
bool operator== (const string< T, TAlloc > &other) const
 Equality operator. More...
 
string< T, TAlloc > & remove (T c)
 Removes characters from a string. More...
 
string< T, TAlloc > & remove (const string< T, TAlloc > &toRemove)
 Removes a string from the string. More...
 
string< T, TAlloc > & removeChars (const string< T, TAlloc > &characters)
 Removes characters from a string. More...
 
string< T, TAlloc > & replace (T toReplace, T replaceWith)
 Replaces all characters of a special type with another one. More...
 
string< T, TAlloc > & replace (const string< T, TAlloc > &toReplace, const string< T, TAlloc > &replaceWith)
 Replaces all instances of a string with another one. More...
 
void reserve (u32 count)
 Reserves some memory. More...
 
u32 size () const
 Returns length of the string's content. More...
 
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). More...
 
string< T > subString (u32 begin, s32 length, bool make_lower=false) const
 Returns a substring. More...
 
string< T, TAlloc > & trim (const string< T, TAlloc > &whitespace=" \t\n\r")
 Trims the string. More...
 
string< T, TAlloc > & validate ()
 verify the existing string. More...
 

Friends

size_t multibyteToWString (string< wchar_t > &destination, const char *source, u32 sourceSize)
 Internally used by the other multibyteToWString functions. More...
 

Detailed Description

template<typename T, typename TAlloc>
class irr::core::string< T, TAlloc >

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.

Definition at line 37 of file irrString.h.

Member Typedef Documentation

◆ char_type

template<typename T, typename TAlloc>
typedef T irr::core::string< T, TAlloc >::char_type

Definition at line 98 of file irrString.h.

Constructor & Destructor Documentation

◆ string() [1/10]

template<typename T, typename TAlloc>
irr::core::string< T, TAlloc >::string ( )
inline

Default constructor.

Definition at line 101 of file irrString.h.

◆ string() [2/10]

template<typename T, typename TAlloc>
irr::core::string< T, TAlloc >::string ( const string< T, TAlloc > &  other)
inline

Constructor.

Definition at line 110 of file irrString.h.

◆ string() [3/10]

template<typename T, typename TAlloc>
template<class B , class A >
irr::core::string< T, TAlloc >::string ( const string< B, A > &  other)
inline

Constructor from other string types.

Definition at line 118 of file irrString.h.

◆ string() [4/10]

template<typename T, typename TAlloc>
irr::core::string< T, TAlloc >::string ( const double  number)
inlineexplicit

Constructs a string from a float.

Definition at line 126 of file irrString.h.

◆ string() [5/10]

template<typename T, typename TAlloc>
irr::core::string< T, TAlloc >::string ( int  number)
inlineexplicit

Constructs a string from an int.

Definition at line 136 of file irrString.h.

◆ string() [6/10]

template<typename T, typename TAlloc>
irr::core::string< T, TAlloc >::string ( unsigned int  number)
inlineexplicit

Constructs a string from an unsigned int.

Definition at line 184 of file irrString.h.

◆ string() [7/10]

template<typename T, typename TAlloc>
irr::core::string< T, TAlloc >::string ( long  number)
inlineexplicit

Constructs a string from a long.

Definition at line 215 of file irrString.h.

◆ string() [8/10]

template<typename T, typename TAlloc>
irr::core::string< T, TAlloc >::string ( unsigned long  number)
inlineexplicit

Constructs a string from an unsigned long.

Definition at line 263 of file irrString.h.

◆ string() [9/10]

template<typename T, typename TAlloc>
template<class B >
irr::core::string< T, TAlloc >::string ( const B *const  c,
u32  length 
)
inline

Constructor for copying a string from a pointer with a given length.

Definition at line 295 of file irrString.h.

◆ string() [10/10]

template<typename T, typename TAlloc>
template<class B >
irr::core::string< T, TAlloc >::string ( const B *const  c)
inline

Constructor for Unicode and ASCII strings.

Definition at line 317 of file irrString.h.

◆ ~string()

template<typename T, typename TAlloc>
irr::core::string< T, TAlloc >::~string ( )
inline

Destructor.

Definition at line 325 of file irrString.h.

Member Function Documentation

◆ append() [1/4]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::append ( character)
inline

Appends a character to this string.

Parameters
characterCharacter to append.

Definition at line 634 of file irrString.h.

Referenced by irr::core::string< fschar_t >::append(), irr::scene::quake3::dumpShader(), irr::scene::quake3::dumpVarGroup(), irr::scene::quake3::getTextures(), and irr::core::string< fschar_t >::operator+=().

◆ append() [2/4]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::append ( const T *const  other,
u32  length = 0xffffffff 
)
inline

Appends a char string to this string.

Parameters
otherChar string to append.
lengthThe length of the string to append.

Definition at line 651 of file irrString.h.

◆ append() [3/4]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::append ( const string< T, TAlloc > &  other)
inline

Appends a string to this string.

Parameters
otherString to append.

Definition at line 683 of file irrString.h.

◆ append() [4/4]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::append ( const string< T, TAlloc > &  other,
u32  length 
)
inline

Appends a string of the length l to this string.

Parameters
otherother String to append to this string.
lengthHow much characters of the other string to add to this one.

Definition at line 706 of file irrString.h.

◆ c_str()

◆ clear()

template<typename T, typename TAlloc>
void irr::core::string< T, TAlloc >::clear ( bool  releaseMemory = true)
inline

Definition at line 514 of file irrString.h.

◆ empty()

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::empty ( ) const
inline

Informs if the string is empty or not.

Returns
True if the string is empty, false if not.

Definition at line 509 of file irrString.h.

◆ equals_ignore_case()

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::equals_ignore_case ( const string< T, TAlloc > &  other) const
inline

Compares the strings ignoring case.

Parameters
otherOther string to compare.
Returns
True if the strings are equal ignoring case.

Definition at line 553 of file irrString.h.

◆ equals_substring_ignore_case()

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::equals_substring_ignore_case ( const string< T, TAlloc > &  other,
const s32  sourcePos = 0 
) const
inline

Compares the strings ignoring case.

Parameters
otherOther string to compare.
sourcePoswhere to start to compare in the string
Returns
True if the strings are equal ignoring case.

Definition at line 566 of file irrString.h.

Referenced by irr::core::isFileExtension().

◆ equalsn() [1/2]

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::equalsn ( const string< T, TAlloc > &  other,
u32  n 
) const
inline

compares the first n characters of the strings

Parameters
otherOther string to compare.
nNumber of characters to compare
Returns
True if the n first characters of both strings are equal.

Definition at line 600 of file irrString.h.

Referenced by irr::core::isInSameDirectory().

◆ equalsn() [2/2]

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::equalsn ( const T *const  str,
u32  n 
) const
inline

compares the first n characters of the strings

Parameters
strOther string to compare.
nNumber of characters to compare
Returns
True if the n first characters of both strings are equal.

Definition at line 617 of file irrString.h.

◆ erase()

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::erase ( u32  index)
inline

Erases a character from the string.

May be slow, because all elements following after the erased element have to be copied.

Parameters
indexIndex of element to be erased.

Definition at line 1327 of file irrString.h.

◆ eraseTrailingFloatZeros()

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::eraseTrailingFloatZeros ( char  decimalPoint = '.')
inline

Erase 0's at the end when a string ends with a floating point number.

After generating strings from floats we often end up with strings ending up with lots of zeros which don't add any value. Erase 'em all. Examples: "0.100000" becomes "0.1" "10.000000" becomes "10" "foo 3.140000" becomes "foo 3.14" "no_num.000" stays "no_num.000" "1." stays "1."

Definition at line 1296 of file irrString.h.

◆ find()

template<typename T, typename TAlloc>
template<class B >
s32 irr::core::string< T, TAlloc >::find ( const B *const  str,
const u32  start = 0 
) const
inline

finds another string in this string

Parameters
strAnother string
startStart position of the search
Returns
Positions where the string has been found, or -1 if not found.

Definition at line 916 of file irrString.h.

Referenced by irr::core::string< fschar_t >::replace().

◆ findFirst()

template<typename T, typename TAlloc>
s32 irr::core::string< T, TAlloc >::findFirst ( c) const
inline

finds first occurrence of character in string

Parameters
cCharacter to search for.
Returns
Position where the character has been found, or -1 if not found.

Definition at line 775 of file irrString.h.

Referenced by irr::core::fast_atof_move().

◆ findFirstChar()

template<typename T, typename TAlloc>
s32 irr::core::string< T, TAlloc >::findFirstChar ( const T *const  c,
u32  count = 1 
) const
inline

finds first occurrence of a character of a list in string

Parameters
cList of characters to find. For example if the method should find the first occurrence of 'a' or 'b', this parameter should be "ab".
countAmount of characters in the list. Usually, this should be strlen(c)
Returns
Position where one of the characters has been found, or -1 if not found.

Definition at line 791 of file irrString.h.

◆ findFirstCharNotInList()

template<typename T, typename TAlloc>
template<class B >
s32 irr::core::string< T, TAlloc >::findFirstCharNotInList ( const B *const  c,
u32  count = 1 
) const
inline

Finds first position of a character not in a given list.

Parameters
cList of characters not to find. For example if the method should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab".
countAmount of characters in the list. Usually, this should be strlen(c)
Returns
Position where the character has been found, or -1 if not found.

Definition at line 813 of file irrString.h.

Referenced by irr::core::string< fschar_t >::trim().

◆ findLast()

template<typename T, typename TAlloc>
s32 irr::core::string< T, TAlloc >::findLast ( c,
s32  start = -1 
) const
inline

finds last occurrence of character in string

Parameters
cCharacter to search for.
startstart to search reverse ( default = -1, on end )
Returns
Position where the character has been found, or -1 if not found.

Definition at line 879 of file irrString.h.

Referenced by irr::core::cutFilenameExtension(), irr::core::getFileNameExtension(), and irr::core::isFileExtension().

◆ findLastChar()

template<typename T, typename TAlloc>
s32 irr::core::string< T, TAlloc >::findLastChar ( const T *const  c,
u32  count = 1 
) const
inline

finds last occurrence of a character of a list in string

Parameters
cList of strings to find. For example if the method should find the last occurrence of 'a' or 'b', this parameter should be "ab".
countAmount of characters in the list. Usually, this should be strlen(c)
Returns
Position where one of the characters has been found, or -1 if not found.

Definition at line 896 of file irrString.h.

◆ findLastCharNotInList()

template<typename T, typename TAlloc>
template<class B >
s32 irr::core::string< T, TAlloc >::findLastCharNotInList ( const B *const  c,
u32  count = 1 
) const
inline

Finds last position of a character not in a given list.

Parameters
cList of characters not to find. For example if the method should find the first occurrence of a character not 'a' or 'b', this parameter should be "ab".
countAmount of characters in the list. Usually, this should be strlen(c)
Returns
Position where the character has been found, or -1 if not found.

Definition at line 840 of file irrString.h.

Referenced by irr::core::string< fschar_t >::eraseTrailingFloatZeros(), and irr::core::string< fschar_t >::trim().

◆ findNext()

template<typename T, typename TAlloc>
s32 irr::core::string< T, TAlloc >::findNext ( c,
u32  startPos 
) const
inline

finds next occurrence of character in string

Parameters
cCharacter to search for.
startPosPosition in string to start searching.
Returns
Position where the character has been found, or -1 if not found.

Definition at line 864 of file irrString.h.

Referenced by irr::core::isInSameDirectory().

◆ insert()

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::insert ( u32  pos,
const char *  s,
u32  n 
)
inline

Insert a certain amount of characters into the string before the given index.

Definition at line 737 of file irrString.h.

◆ lastChar()

template<typename T, typename TAlloc>
T irr::core::string< T, TAlloc >::lastChar ( ) const
inline

gets the last char of a string or null

Definition at line 1366 of file irrString.h.

◆ lower_ignore_case()

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::lower_ignore_case ( const string< T, TAlloc > &  other) const
inline

Compares the strings ignoring case.

Parameters
otherOther string to compare.
Returns
True if this string is smaller ignoring case.

Definition at line 583 of file irrString.h.

◆ make_lower()

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::make_lower ( )
inline

Makes the string lower case.

Definition at line 533 of file irrString.h.

Referenced by irr::io::SNamedPath::PathToName(), and irr::core::string< fschar_t >::subString().

◆ make_upper()

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::make_upper ( )
inline

Makes the string upper case.

Definition at line 542 of file irrString.h.

◆ operator []() [1/2]

template<typename T, typename TAlloc>
T& irr::core::string< T, TAlloc >::operator [] ( const u32  index)
inline

Direct access operator.

Definition at line 430 of file irrString.h.

◆ operator []() [2/2]

template<typename T, typename TAlloc>
const T& irr::core::string< T, TAlloc >::operator [] ( const u32  index) const
inline

Direct access operator.

Definition at line 438 of file irrString.h.

◆ operator!=() [1/2]

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::operator!= ( const T *const  str) const
inline

Inequality operator.

Definition at line 486 of file irrString.h.

◆ operator!=() [2/2]

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::operator!= ( const string< T, TAlloc > &  other) const
inline

Inequality operator.

Definition at line 493 of file irrString.h.

◆ operator+() [1/2]

template<typename T, typename TAlloc>
string<T,TAlloc> irr::core::string< T, TAlloc >::operator+ ( const string< T, TAlloc > &  other) const
inline

Append operator for other strings.

Definition at line 409 of file irrString.h.

◆ operator+() [2/2]

template<typename T, typename TAlloc>
template<class B >
string<T,TAlloc> irr::core::string< T, TAlloc >::operator+ ( const B *const  c) const
inline

Append operator for strings, ASCII and Unicode.

Definition at line 420 of file irrString.h.

◆ operator+=() [1/9]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator+= ( c)
inline

Appends a character to this string.

Parameters
cCharacter to append.

Definition at line 982 of file irrString.h.

◆ operator+=() [2/9]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator+= ( const T *const  c)
inline

Appends a char string to this string.

Parameters
cChar string to append.

Definition at line 991 of file irrString.h.

◆ operator+=() [3/9]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator+= ( const string< T, TAlloc > &  other)
inline

Appends a string to this string.

Parameters
otherString to append.

Definition at line 1000 of file irrString.h.

◆ operator+=() [4/9]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator+= ( const int  i)
inline

Appends a string representation of a number to this string.

Parameters
iNumber to append.

Definition at line 1009 of file irrString.h.

◆ operator+=() [5/9]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator+= ( const unsigned int  i)
inline

Appends a string representation of a number to this string.

Parameters
iNumber to append.

Definition at line 1018 of file irrString.h.

◆ operator+=() [6/9]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator+= ( const long  i)
inline

Appends a string representation of a number to this string.

Parameters
iNumber to append.

Definition at line 1027 of file irrString.h.

◆ operator+=() [7/9]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator+= ( const unsigned long  i)
inline

Appends a string representation of a number to this string.

Parameters
iNumber to append.

Definition at line 1036 of file irrString.h.

◆ operator+=() [8/9]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator+= ( const double  i)
inline

Appends a string representation of a number to this string.

Parameters
iNumber to append.

Definition at line 1045 of file irrString.h.

◆ operator+=() [9/9]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator+= ( const float  i)
inline

Appends a string representation of a number to this string.

Parameters
iNumber to append.

Definition at line 1054 of file irrString.h.

◆ operator<()

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::operator< ( const string< T, TAlloc > &  other) const
inline

Is smaller comparator.

Definition at line 472 of file irrString.h.

◆ operator=() [1/3]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator= ( const string< T, TAlloc > &  other)
inline

Assignment operator.

Definition at line 332 of file irrString.h.

◆ operator=() [2/3]

template<typename T, typename TAlloc>
template<class B , class A >
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator= ( const string< B, A > &  other)
inline

Assignment operator for other string types.

Definition at line 354 of file irrString.h.

◆ operator=() [3/3]

template<typename T, typename TAlloc>
template<class B >
string<T,TAlloc>& irr::core::string< T, TAlloc >::operator= ( const B *const  c)
inline

Assignment operator for strings, ASCII and Unicode.

Definition at line 363 of file irrString.h.

◆ operator==() [1/2]

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::operator== ( const T *const  str) const
inline

Equality operator.

Definition at line 446 of file irrString.h.

◆ operator==() [2/2]

template<typename T, typename TAlloc>
bool irr::core::string< T, TAlloc >::operator== ( const string< T, TAlloc > &  other) const
inline

Equality operator.

Definition at line 461 of file irrString.h.

◆ remove() [1/2]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::remove ( c)
inline

Removes characters from a string.

Parameters
cCharacter to remove.

Definition at line 1184 of file irrString.h.

◆ remove() [2/2]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::remove ( const string< T, TAlloc > &  toRemove)
inline

Removes a string from the string.

Parameters
toRemoveString to remove.

Definition at line 1206 of file irrString.h.

◆ removeChars()

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::removeChars ( const string< T, TAlloc > &  characters)
inline

Removes characters from a string.

Parameters
charactersCharacters to remove.

Definition at line 1239 of file irrString.h.

◆ replace() [1/2]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::replace ( toReplace,
replaceWith 
)
inline

Replaces all characters of a special type with another one.

Parameters
toReplaceCharacter to replace.
replaceWithCharacter replacing the old one.

Definition at line 1064 of file irrString.h.

Referenced by irr::io::SNamedPath::PathToName(), and irr::core::string< fschar_t >::replace().

◆ replace() [2/2]

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::replace ( const string< T, TAlloc > &  toReplace,
const string< T, TAlloc > &  replaceWith 
)
inline

Replaces all instances of a string with another one.

Parameters
toReplaceThe string to replace.
replaceWithThe string replacing the old one.

Definition at line 1076 of file irrString.h.

◆ reserve()

template<typename T, typename TAlloc>
void irr::core::string< T, TAlloc >::reserve ( u32  count)
inline

Reserves some memory.

Parameters
countAmount of characters to reserve.

Definition at line 762 of file irrString.h.

Referenced by irr::core::string< fschar_t >::insert().

◆ size()

template<typename T, typename TAlloc>
u32 irr::core::string< T, TAlloc >::size ( ) const
inline

◆ split()

template<typename T, typename TAlloc>
template<class container >
u32 irr::core::string< T, TAlloc >::split ( container &  ret,
const T *const  delimiter,
u32  countDelimiters = 1,
bool  ignoreEmptyTokens = true,
bool  keepSeparators = false 
) const
inline

Split string into parts (tokens).

This method will split a string at certain delimiter characters into the container passed in as reference. The type of the container has to be given as template parameter. It must provide a push_back and a size method.

Parameters
retThe result container. Tokens are added, the container is not cleared.
delimiterC-style string of delimiter characters
countDelimitersNumber of delimiter characters
ignoreEmptyTokensFlag to avoid empty substrings in the result container. If two delimiters occur without a character in between, an empty substring would be placed in the result. If this flag is set, only non-empty strings are stored.
keepSeparatorsFlag which allows to add the separator to the result string. If this flag is true, the concatenation of the substrings results in the original string. Otherwise, only the characters between the delimiters are returned.
Returns
The number of resulting substrings

Definition at line 1390 of file irrString.h.

◆ subString()

template<typename T, typename TAlloc>
string<T> irr::core::string< T, TAlloc >::subString ( u32  begin,
s32  length,
bool  make_lower = false 
) const
inline

Returns a substring.

Parameters
beginStart of substring.
lengthLength of substring.
make_lowercopy only lower case

Definition at line 948 of file irrString.h.

Referenced by irr::core::cutFilenameExtension(), irr::core::getFileNameExtension(), and irr::core::string< fschar_t >::trim().

◆ trim()

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::trim ( const string< T, TAlloc > &  whitespace = " \t\n\r")
inline

Trims the string.

Removes the specified characters (by default, Latin-1 whitespace) from the beginning and the end of the string.

Definition at line 1275 of file irrString.h.

◆ validate()

template<typename T, typename TAlloc>
string<T,TAlloc>& irr::core::string< T, TAlloc >::validate ( )
inline

verify the existing string.

Definition at line 1339 of file irrString.h.

Referenced by irr::core::deletePathFromPath().

Friends And Related Function Documentation

◆ multibyteToWString

template<typename T, typename TAlloc>
size_t multibyteToWString ( string< wchar_t > &  destination,
const char *  source,
u32  sourceSize 
)
friend

Internally used by the other multibyteToWString functions.

Definition at line 1487 of file irrString.h.


The documentation for this class was generated from the following file: