A string class. More...
#include "murl_string.h"
Public Types | |
using | ConstIterator = const Char * |
Definition of the const iterator. | |
Public Member Functions | |
String () noexcept | |
Construct an empty string. | |
String (const String &str) noexcept | |
Construct using a given string. More... | |
String (String &&str) noexcept | |
Construct using a given string. More... | |
String (const Char *str) | |
Construct a copy from a given C string. More... | |
String (const String &str, SInt32 length) | |
Construct a copy of a given string and length. More... | |
String (const String &str, SInt32 length, Bool trimTrailingDelimiters) | |
Construct a copy of a given string and length. More... | |
String (const Char *str, SInt32 length) | |
Construct a string from a given C string & length. More... | |
String (const Char *str, SInt32 length, Bool trimTrailingDelimiters) | |
Construct a string from a given C string & length. More... | |
String (const UInt8 *str, SInt32 length) | |
Construct a copy from a given byte pointer and length. More... | |
String (const UInt8 *str, SInt32 length, Bool trimTrailingDelimiters) | |
Construct a string from a given byte pointer and length. More... | |
String (Char charCode, SInt32 length) | |
Construct and fill a string with a given character and length. More... | |
~String () | |
Destroy the string. | |
void | Clear () |
Clear the string and remove the underlying storage. | |
void | Shrink () |
Shrink the string so that the underlying storage is only as large as necessary. | |
Bool | Reserve (SInt32 count) |
Reserve additional storage space. More... | |
Bool | CutAt (SInt32 pos) |
Cut the string on a given position. More... | |
String | Trim () const |
Trim white spaces from left and right. More... | |
String | TrimLeft () const |
Trim white spaces from left. More... | |
String | TrimRight () const |
Trim white spaces from right. More... | |
String | ToLowerUTF8 () const |
Get the lower case string including UTF-8 characters. More... | |
String | ToUpperUTF8 () const |
Get the upper case string including UTF-8 characters. More... | |
SInt32 | GetLengthUTF8 () const |
Count the number of UTF-8 characters. More... | |
String | GetUTF8Char (SInt32 pos) const |
Get a UTF-8 character at a specified position. More... | |
StringArray | GetUTF8Chars () const |
Get the UTF-8 characters. More... | |
WCharArray | GetWChars () const |
Get the wide-characters. More... | |
Bool | GetWChars (WCharArray &wcharArray) const |
Get the wide-characters and success status. More... | |
UInt16Array | GetUTF16Chars () const |
Get the UTF-16 characters. More... | |
Bool | GetUTF16Chars (UInt16Array &utf16Array) const |
Get the UTF-16 characters and success status. More... | |
UInt32Array | GetUTF32Chars () const |
Get the UTF-32 characters. More... | |
Bool | GetUTF32Chars (UInt32Array &utf32Array) const |
Get the UTF-32 characters and success status. More... | |
Bool | SetWChars (const WCharArray &wcharArray) |
Set UTF-8 characters from a wide-character string. More... | |
Bool | SetWChars (const WChar *wcharArray) |
Set UTF-8 characters from a wide-character string pointer. More... | |
Bool | SetUTF16Chars (const UInt16Array &utf16Array) |
Set UTF-8 characters from an UTF16 string. More... | |
Bool | SetUTF16Chars (const UInt16 *utf16Array) |
Set UTF-8 characters from an UTF16 string pointer. More... | |
Bool | SetUTF32Chars (const UInt32Array &utf32Array) |
Set UTF-8 characters from an UTF32 string. More... | |
Bool | SetUTF32Chars (const UInt32 *utf32Array) |
Set UTF-8 characters from an UTF32 string pointer. More... | |
String & | Cat (const StringArray &stringArray) |
Append all strings from an string array. More... | |
Bool | RemoveLastUTF8 () |
Remove the last character from the string including UTF-8. More... | |
Char | GetChar (SInt32 pos) const |
Get a character at a specified position. More... | |
Bool | Set (SInt32 pos, Char charCode) |
Set a character. More... | |
void | Set (const String &str) |
Set to a given string. More... | |
void | Set (const Char *str, SInt32 length) |
Set to a given C string and length. More... | |
void | Set (const Char *str, SInt32 length, Bool trimTrailingDelimiters) |
Set to a given C string and length. More... | |
Bool | Insert (SInt32 pos, Char charCode) |
Insert a character. More... | |
Bool | Insert (SInt32 pos, const Char *str, SInt32 count) |
Insert a C string & length. More... | |
Bool | Insert (SInt32 pos, const String &str) |
Insert a string. More... | |
Bool | Insert (SInt32 pos, const Char *str) |
Insert a C string. More... | |
Bool | Remove (SInt32 pos, SInt32 count=1) |
Remove character(s). More... | |
SInt32 | RemoveChar (Char character) |
Remove all occurrences of a character. More... | |
String & | Cat (const Char *str) |
Append a C string. More... | |
String & | Cat (const String &str) |
Append a string. More... | |
Bool | AppendUtf32 (UInt32 utf32CharCode) |
Append one UTF-32 character. More... | |
Bool | AppendUtf32 (UInt32 utf32CharCode, SInt32 count) |
Append UTF-32 characters. More... | |
Bool | AppendUtf32 (const UInt32 *utf32str, SInt32 length) |
Append UTF-32 characters from a given pointer and length. More... | |
String & | Cat (Char charCode, SInt32 count) |
Append characters. More... | |
String & | Cat (const String &str, SInt32 length) |
Append from a given string and length. More... | |
String & | Cat (const UInt8 *str, SInt32 length) |
Append from a given byte pointer and length. More... | |
String & | Cat () |
Get a reference of the string. More... | |
String & | Cat (Char charCode) |
Append a character. More... | |
String & | Cat (const Char *str, SInt32 length) |
Append from a given C string & length. More... | |
String | Mid (SInt32 from, SInt32 count) const |
Get a substring copy. More... | |
String | Mid (const String &startDelimiter, const String &endDelimiter, Bool isStartOptional=true, Bool isEndOptional=true) const |
Get a substring copy using delimiters. More... | |
String | Mid (SInt32 from) const |
Get a substring copy. More... | |
String | Right (SInt32 count) const |
Get a substring from the right. More... | |
String | Left (SInt32 count) const |
Get a substring from the left. More... | |
UInt32 | Replace (const Char *find, SInt32 findLen, const Char *replace, SInt32 replaceLen) |
Find any occurrence of a C string & length and replace each occurrence by a C string & length. More... | |
UInt32 | Replace (const String &find, const String &replace) |
Find any occurrence of a string and replace each occurrence by a string. More... | |
UInt32 | Replace (const Char *find, const Char *replace) |
Find any occurrence of a C string and replace each occurrence by a C string. More... | |
UInt32 | Replace (const String &find, const Char *replace) |
Find any occurrence of a string and replace each occurrence by a C string. More... | |
UInt32 | Replace (const Char *find, const String &replace) |
Find any occurrence of a C string and replace each occurrence by a string. More... | |
SInt32 | Find (Char charCode, SInt32 from=0) const |
Find a character. More... | |
SInt32 | Find (SInt32 length, const Char *str, SInt32 from) const |
Find a C string & length. More... | |
SInt32 | Find (const Char *str, SInt32 from=0) const |
Find a C string. More... | |
SInt32 | Find (const String &str, SInt32 from=0) const |
Find a string. More... | |
SInt32 | ReverseFind (Char charCode, SInt32 from) const |
Find a character from right to left. More... | |
SInt32 | ReverseFind (Char charCode) const |
Find a character from right to left. More... | |
SInt32 | ReverseFind (SInt32 length, const Char *str, SInt32 from) const |
Find a C string & length from right to left at position. More... | |
SInt32 | ReverseFind (const Char *str, SInt32 from) const |
Find a C string from right to left at position. More... | |
SInt32 | ReverseFind (const String &str, SInt32 from) const |
Find a string from right to left at position. More... | |
SInt32 | ReverseFind (const Char *str) const |
Find a C string from right to left. More... | |
SInt32 | ReverseFind (const String &str) const |
Find a string from right to left. More... | |
SInt32 | FindFirstOf (SInt32 length, const Char *str, SInt32 from) const |
Find first character from a character set C string & length. More... | |
SInt32 | FindFirstOf (const Char *str, SInt32 from=0) const |
Find first character from a character set C string. More... | |
SInt32 | FindFirstOf (const String &str, SInt32 from=0) const |
Find first character from a character set string. More... | |
SInt32 | FindFirstNotOf (SInt32 length, const Char *str, SInt32 from) const |
Find the first character not matching any of the characters in a given set. More... | |
SInt32 | FindFirstNotOf (const Char *str, SInt32 from=0) const |
Find the first character not matching any of the characters in a given set. More... | |
SInt32 | FindFirstNotOf (const String &str, SInt32 from=0) const |
Find the first character not matching any of the characters in a given set. More... | |
Bool | StartsWith (const Char *str, SInt32 length) const |
Check if the start matches a C string & length. More... | |
Bool | StartsWith (const Char *str) const |
Check if the start matches a C string. More... | |
Bool | StartsWith (const String &str) const |
Check if the start matches a string. More... | |
Bool | EndsWith (const Char *str, SInt32 length) const |
Check if the end matches a C string & length. More... | |
Bool | EndsWith (const Char *str) const |
Check if the end matches a C string. More... | |
Bool | EndsWith (const String &str) const |
Check if the end matches a string. More... | |
SInt32 | Compare (const Char *str) const |
Compare a C string. More... | |
SInt32 | Compare (const String &str) const |
Compare a string. More... | |
Bool | IsEqual (const Char *str) const |
Check if a C string is equal. More... | |
Bool | IsEqual (const String &str) const |
Check if a string is equal. More... | |
UInt32 | GetHashValue () const |
Calculate the string hash value. More... | |
SInt32 | GetAlloc () const |
Get the number of allocated bytes for characters, excluding the zero terminator. More... | |
SInt32 | GetLength () const |
Get number of byte characters. More... | |
Bool | IsEmpty () const |
Check if the string is empty. More... | |
const String & | ToString () const |
Get a const reference of the string. More... | |
const Char * | Begin () const |
Get the pointer to the first character. More... | |
const Char * | End () const |
Get the pointer to the end of the string. More... | |
const Char * | Last () const |
Get the pointer to the last character. More... | |
operator const Char * () const | |
Conversion operator to C string. More... | |
operator const UInt8 * () const | |
Conversion operator to byte pointer. More... | |
operator const void * () const | |
Conversion operator to void pointer. More... | |
Char | operator[] (SInt32 pos) const |
The array operator. More... | |
Char | operator* () const |
Indirection operator. More... | |
String & | operator= (const Char *str) |
Assignment operator for C string. More... | |
String & | operator= (const String &str) |
Assignment operator for string. More... | |
String & | operator= (String &&str) noexcept |
Move operator for string. More... | |
const String & | operator+= (Char chr) |
In-place addition operator for a character. More... | |
const String & | operator+= (const Char *str) |
In-place addition operator for const C string. More... | |
const String & | operator+= (const String &str) |
In-place addition operator for string. More... | |
const String & | operator+= (UInt64 value) |
In-place addition operator for UInt64. More... | |
const String & | operator+= (SInt64 value) |
In-place addition operator for SInt64. More... | |
const String & | operator+= (UInt32 value) |
In-place addition operator for UInt32. More... | |
const String & | operator+= (SInt32 value) |
In-place addition operator for SInt32. More... | |
const String & | operator+= (Double value) |
In-place addition operator for Double. More... | |
const String & | operator+= (const Color &value) |
In-place addition operator for Color. More... | |
const String & | operator+= (Bool value) |
In-place addition operator for Bool. More... | |
const String & | operator+= (const System::Time &value) |
In-place addition operator for Color. More... | |
void | Swap (String &other) |
Exchange the content of the string with a given second one. More... | |
Friends | |
String | operator+ (const String &lhs, const String &rhs) |
Addition operator for string and string. More... | |
String | operator+ (const String &lhs, const Char *rhs) |
Addition operator for string and C string. More... | |
String | operator+ (const Char *lhs, const String &rhs) |
Addition operator for C string and string. More... | |
String | operator+ (const String &lhs, Char rhs) |
Addition operator for string and character. More... | |
String | operator+ (Char lhs, const String &rhs) |
Addition operator for character and string. More... | |
String | operator+ (const String &lhs, UInt64 rhs) |
Addition operator for UInt64 and string. More... | |
String | operator+ (const String &lhs, SInt64 rhs) |
Addition operator for SInt64 and string. More... | |
String | operator+ (const String &lhs, UInt32 rhs) |
Addition operator for UInt32 and string. More... | |
String | operator+ (const String &lhs, SInt32 rhs) |
Addition operator for SInt32 and string. More... | |
String | operator+ (const String &lhs, Double rhs) |
Addition operator for Double and string. More... | |
String | operator+ (const String &lhs, const Color &rhs) |
Addition operator for Color and string. More... | |
String | operator+ (const String &lhs, Bool rhs) |
Addition operator for Bool and string. More... | |
String | operator+ (const String &lhs, const System::Time &rhs) |
Addition operator for Time and string. More... | |
bool | operator< (const String &lhs, const String &rhs) |
Less than operator for string and string. More... | |
bool | operator< (const String &lhs, const Char *rhs) |
Less than operator for string and C string. More... | |
bool | operator< (const Char *lhs, const String &rhs) |
Less than operator for C string and string. More... | |
bool | operator<= (const String &lhs, const String &rhs) |
Less than or equal to operator for string and string. More... | |
bool | operator<= (const String &lhs, const Char *rhs) |
Less than or equal to operator for string and C string. More... | |
bool | operator<= (const Char *lhs, const String &rhs) |
Less than or equal to operator for C string and string. More... | |
bool | operator> (const String &lhs, const String &rhs) |
Greater than operator for string and string. More... | |
bool | operator> (const String &lhs, const Char *rhs) |
Greater than operator for string and C string. More... | |
bool | operator> (const Char *lhs, const String &rhs) |
Greater than operator for C string and string. More... | |
bool | operator>= (const String &lhs, const String &rhs) |
Greater than or equal to operator for string and string. More... | |
bool | operator>= (const String &lhs, const Char *rhs) |
Greater than or equal to operator for string and C string. More... | |
bool | operator>= (const Char *lhs, const String &rhs) |
Greater than or equal to operator for C string and string. More... | |
bool | operator== (const String &lhs, const String &rhs) |
Equal to comparison operator for string and string. More... | |
bool | operator== (const String &lhs, const Char *rhs) |
Equal to comparison operator for string and C string. More... | |
bool | operator== (const Char *lhs, const String &rhs) |
Equal to comparison operator for C string and string. More... | |
bool | operator!= (const String &lhs, const String &rhs) |
Not equal to comparison operator for string and string. More... | |
bool | operator!= (const String &lhs, const Char *rhs) |
Not equal to comparison operator for string and C string. More... | |
bool | operator!= (const Char *lhs, const String &rhs) |
Not equal to comparison operator for C string and string. More... | |
Detailed Description
A string class.
The string class contains an array of byte characters which can store an 8 bit encoded string or an UTF-8 encoded string. The array of characters is zero terminated.
A C string is a pointer to an array of byte characters which is zero-terminated.
This class is based on the NTL String container, see http://www.ultimatepp.org
Constructor & Destructor Documentation
◆ String() [1/10]
|
inlinenoexcept |
Construct using a given string.
- Parameters
-
str The original string.
◆ String() [2/10]
|
inlinenoexcept |
◆ String() [3/10]
|
inline |
Construct a copy from a given C string.
- Parameters
-
str The C string to copy.
◆ String() [4/10]
Construct a copy of a given string and length.
Verify (assert in debug build) 'length' against the length of 'str'. Any trailing zero bytes from str[length-1] downwards will be trimmed, and length will be decreased accordingly. This is equivalent to using the constructor form String(str, length, true)
- Parameters
-
str The string to copy. length The number of bytes to copy.
◆ String() [5/10]
Construct a copy of a given string and length.
If trimTrailingDelimiters is true, any trailing zero bytes from str[length-1] downwards will be trimmed, and length will be decreased accordingly. Otherwise, the given string is copied 'as-is', and any trailing zero bytes will be included in the number returned by GetLength().
- Parameters
-
str The string to copy. length The number of bytes to copy. trimTrailingDelimiters If true, trailing zero bytes are trimmed.
References Begin().
◆ String() [6/10]
Construct a string from a given C string & length.
Any trailing zero bytes from str[length-1] downwards will be trimmed, and length will be decreased accordingly. This is equivalent to using the constructor form String(str, length, true)
- Parameters
-
str The C string to copy. length The number of bytes to copy.
◆ String() [7/10]
Construct a string from a given C string & length.
If trimTrailingDelimiters is true, any trailing zero bytes from str[length-1] downwards will be trimmed, and length will be decreased accordingly. Otherwise, the given C string is copied 'as-is', and any trailing zero bytes will be included in the number returned by GetLength().
- Parameters
-
str The C string to copy. length The number of bytes to copy. trimTrailingDelimiters If true, trailing zero bytes are trimmed.
◆ String() [8/10]
Construct a copy from a given byte pointer and length.
Any trailing zero bytes from str[length-1] downwards will be trimmed, and length will be decreased accordingly. This is equivalent to using the constructor form String(str, length, true)
- Parameters
-
str The byte pointer to copy. length The number of bytes to copy.
◆ String() [9/10]
Construct a string from a given byte pointer and length.
If trimTrailingDelimiters is true, any trailing zero bytes from str[length-1] downwards will be trimmed, and length will be decreased accordingly. Otherwise, the given C string is copied 'as-is', and any trailing zero bytes will be included in the number returned by GetLength().
- Parameters
-
str The byte pointer to copy. length The number of bytes to copy. trimTrailingDelimiters If true, trailing zero bytes are trimmed.
◆ String() [10/10]
Construct and fill a string with a given character and length.
- Parameters
-
charCode The character code to fill. length The number of bytes to fill.
References Cat().
Member Function Documentation
◆ Reserve()
Reserve additional storage space.
- Parameters
-
count The number of additional bytes to reserve.
- Returns
- true if successful.
References CutAt(), GetLength(), and Insert().
◆ CutAt()
Cut the string on a given position.
Verify (assert in debug build) 'pos' against the string length.
- Parameters
-
pos The position to cut the string.
- Returns
- true if successful.
Referenced by Reserve().
◆ Trim()
String Murl::String::Trim | ( | ) | const |
Trim white spaces from left and right.
- Returns
- The trimmed string.
◆ TrimLeft()
String Murl::String::TrimLeft | ( | ) | const |
Trim white spaces from left.
- Returns
- The trimmed string.
◆ TrimRight()
String Murl::String::TrimRight | ( | ) | const |
Trim white spaces from right.
- Returns
- The trimmed string.
◆ ToLowerUTF8()
String Murl::String::ToLowerUTF8 | ( | ) | const |
Get the lower case string including UTF-8 characters.
- Returns
- The lower case UTF-8 string.
◆ ToUpperUTF8()
String Murl::String::ToUpperUTF8 | ( | ) | const |
Get the upper case string including UTF-8 characters.
- Returns
- The upper case UTF-8 string.
◆ GetLengthUTF8()
SInt32 Murl::String::GetLengthUTF8 | ( | ) | const |
Count the number of UTF-8 characters.
- Returns
- The number of UTF-8 characters.
◆ GetUTF8Char()
Get a UTF-8 character at a specified position.
Verify (assert in debug build) 'pos' against the string length.
- Parameters
-
pos The byte position to get the character from.
- Returns
- The UTF-8 character at the specified position, or an empty string if the position is out of range.
◆ GetUTF8Chars()
StringArray Murl::String::GetUTF8Chars | ( | ) | const |
Get the UTF-8 characters.
- Returns
- The UTF-8 characters string array.
◆ GetWChars() [1/2]
|
inline |
Get the wide-characters.
- Returns
- The wide-characters array, if the conversion fails the characters array is empty.
References Murl::Array< DataType >::Clear().
◆ GetWChars() [2/2]
Bool Murl::String::GetWChars | ( | WCharArray & | wcharArray | ) | const |
Get the wide-characters and success status.
- Parameters
-
wcharArray The wide-characters array return value.
- Returns
- true if successful, if conversion fails the wcharArray contains the already converted characters and false is returned.
◆ GetUTF16Chars() [1/2]
|
inline |
Get the UTF-16 characters.
- Returns
- The UTF-16 characters array, if the conversion fails the characters array is empty.
References Murl::Array< DataType >::Clear().
◆ GetUTF16Chars() [2/2]
Bool Murl::String::GetUTF16Chars | ( | UInt16Array & | utf16Array | ) | const |
Get the UTF-16 characters and success status.
- Parameters
-
utf16Array The UTF-16 characters array return value.
- Returns
- true if successful, if conversion fails the utf16Array contains the already converted characters and false is returned.
◆ GetUTF32Chars() [1/2]
|
inline |
Get the UTF-32 characters.
- Returns
- The UTF-32 characters array, if the conversion fails the characters array is empty.
References Murl::Array< DataType >::Clear().
◆ GetUTF32Chars() [2/2]
Bool Murl::String::GetUTF32Chars | ( | UInt32Array & | utf32Array | ) | const |
Get the UTF-32 characters and success status.
- Parameters
-
utf32Array The UTF-32 characters array return value.
- Returns
- true if successful, if conversion fails the utf32Array contains the already converted characters and false is returned.
◆ SetWChars() [1/2]
Bool Murl::String::SetWChars | ( | const WCharArray & | wcharArray | ) |
Set UTF-8 characters from a wide-character string.
- Parameters
-
wcharArray The wide-characters array.
- Returns
- true if successful, if conversion fails this String contains the already converted characters and false is returned.
◆ SetWChars() [2/2]
Set UTF-8 characters from a wide-character string pointer.
- Parameters
-
wcharArray A pointer to the zero-terminated wide-characters.
- Returns
- true if successful, if conversion fails this String contains the already converted characters and false is returned.
◆ SetUTF16Chars() [1/2]
Bool Murl::String::SetUTF16Chars | ( | const UInt16Array & | utf16Array | ) |
Set UTF-8 characters from an UTF16 string.
- Parameters
-
utf16Array The UTF-16 characters array.
- Returns
- true if successful, if conversion fails this String contains the already converted characters and false is returned.
◆ SetUTF16Chars() [2/2]
Set UTF-8 characters from an UTF16 string pointer.
- Parameters
-
utf16Array A pointer to the zero-terminated UTF16 characters.
- Returns
- true if successful, if conversion fails this String contains the already converted characters and false is returned.
◆ SetUTF32Chars() [1/2]
Bool Murl::String::SetUTF32Chars | ( | const UInt32Array & | utf32Array | ) |
Set UTF-8 characters from an UTF32 string.
- Parameters
-
utf32Array The UTF-32 characters array.
- Returns
- true if successful, if conversion fails this String contains the already converted characters and false is returned.
◆ SetUTF32Chars() [2/2]
Set UTF-8 characters from an UTF32 string pointer.
- Parameters
-
utf32Array A pointer to the zero-terminated UTF32 characters.
- Returns
- true if successful, if conversion fails this String contains the already converted characters and false is returned.
◆ Cat() [1/9]
|
inline |
Append all strings from an string array.
- Parameters
-
stringArray The string array to append.
- Returns
- The string itself.
References Cat(), and Murl::Array< DataType >::GetCount().
◆ RemoveLastUTF8()
Bool Murl::String::RemoveLastUTF8 | ( | ) |
Remove the last character from the string including UTF-8.
- Returns
- true if successful, false is string is empty.
◆ GetChar()
Get a character at a specified position.
Verify (assert in debug build) 'pos' against the string length.
- Parameters
-
pos The byte position to get the character from.
- Returns
- The character at the specified position, or 0 if the position is out of range.
◆ Set() [1/4]
Set a character.
Verify (assert in debug build) 'pos' against the string length.
- Parameters
-
pos The byte position. charCode The character code to set.
- Returns
- true if successful.
◆ Set() [2/4]
|
inline |
Set to a given string.
- Parameters
-
str The string to set.
◆ Set() [3/4]
Set to a given C string and length.
Any trailing zero bytes from str[length-1] downwards will be trimmed, and length will be decreased accordingly. This is equivalent to calling Set(str, length, true).
- Parameters
-
str The string to copy. length The number of bytes to copy.
◆ Set() [4/4]
Set to a given C string and length.
If trimTrailingDelimiters is true, any trailing zero bytes from str[length-1] downwards will be trimmed, and length will be decreased accordingly. Otherwise, the given C string is copied 'as-is', and any trailing zero bytes will be included in the number returned by GetLength().
- Parameters
-
str The string to copy. trimTrailingDelimiters If true, trailing zero bytes are trimmed. length The number of bytes to copy.
◆ Insert() [1/4]
◆ Insert() [2/4]
Insert a C string & length.
- Parameters
-
pos The byte position to insert. str The C string to insert. count The number of bytes to insert.
- Returns
- true if successful.
References Insert().
◆ Insert() [3/4]
Insert a string.
- Parameters
-
pos The byte position to insert. str The string to insert.
- Returns
- true if successful.
References GetLength(), and Insert().
◆ Insert() [4/4]
Insert a C string.
- Parameters
-
pos The byte position to insert. str The C string to insert.
- Returns
- true if successful.
References Insert().
◆ Remove()
Remove character(s).
Verify (assert in debug build) 'pos' and 'count' against the string length.
- Parameters
-
pos The byte position to remove. count The number of characters to remove.
- Returns
- true if successful.
◆ RemoveChar()
Remove all occurrences of a character.
- Parameters
-
character The character to remove.
- Returns
- The number of characters removed.
◆ Cat() [2/9]
Append a C string.
- Parameters
-
str The C string to append.
- Returns
- The string itself.
References Cat().
◆ Cat() [3/9]
Append a string.
- Parameters
-
str The string to append.
- Returns
- The string itself.
References Begin(), Cat(), and GetLength().
◆ AppendUtf32() [1/3]
Append one UTF-32 character.
- Parameters
-
utf32CharCode The UTF-32 character code to append.
- Returns
- true if successful.
◆ AppendUtf32() [2/3]
Append UTF-32 characters.
- Parameters
-
utf32CharCode The UTF-32 character code to append. count The number of characters to append.
- Returns
- true if successful.
◆ AppendUtf32() [3/3]
Append UTF-32 characters from a given pointer and length.
- Parameters
-
utf32str The UTF-32 pointer to append. length The number of bytes to copy.
- Returns
- true if successful.
◆ Cat() [4/9]
Append characters.
- Parameters
-
charCode The character code to append. count The number of characters to append.
- Returns
- The string itself.
◆ Cat() [5/9]
◆ Cat() [6/9]
Append from a given byte pointer and length.
- Parameters
-
str The byte pointer to append. length The number of bytes to copy.
- Returns
- The string itself.
References Cat().
◆ Cat() [7/9]
|
inline |
Get a reference of the string.
- Returns
- The string reference.
Referenced by Cat(), operator+=(), and String().
◆ Cat() [8/9]
Append a character.
- Parameters
-
charCode The character code to append.
- Returns
- The string itself.
◆ Cat() [9/9]
Append from a given C string & length.
- Parameters
-
str The C string to append. length The number of bytes to copy.
- Returns
- The string itself.
◆ Mid() [1/3]
◆ Mid() [2/3]
String Murl::String::Mid | ( | const String & | startDelimiter, |
const String & | endDelimiter, | ||
Bool | isStartOptional = true , |
||
Bool | isEndOptional = true |
||
) | const |
Get a substring copy using delimiters.
- Parameters
-
startDelimiter The start delimiter string. endDelimiter The end delimiter string. isStartOptional false if start delimiter is required to be found. isEndOptional false if end delimiter is required to be found.
- Returns
- The substring, or an empty string is a required limiter is not found.
◆ Mid() [3/3]
Get a substring copy.
- Parameters
-
from The byte position to start.
- Returns
- The substring.
References GetLength(), and Mid().
◆ Right()
Get a substring from the right.
- Parameters
-
count Number of bytes to copy.
- Returns
- The substring.
References GetLength(), and Mid().
◆ Left()
Get a substring from the left.
- Parameters
-
count Number of bytes to copy.
- Returns
- The substring.
References Mid().
◆ Replace() [1/5]
UInt32 Murl::String::Replace | ( | const Char * | find, |
SInt32 | findLen, | ||
const Char * | replace, | ||
SInt32 | replaceLen | ||
) |
Find any occurrence of a C string & length and replace each occurrence by a C string & length.
- Parameters
-
find The C string to find. findLen The number of bytes to find. replace The C string to replace. replaceLen The number of bytes to replace.
- Returns
- The number of replaced occurrences.
Referenced by Replace().
◆ Replace() [2/5]
Find any occurrence of a string and replace each occurrence by a string.
- Parameters
-
find The string to find. replace The string to replace.
- Returns
- The number of replaced occurrences.
References Begin(), GetLength(), and Replace().
◆ Replace() [3/5]
Find any occurrence of a C string and replace each occurrence by a C string.
- Parameters
-
find The C string to find. replace The C string to replace.
- Returns
- The number of replaced occurrences.
References Replace().
◆ Replace() [4/5]
Find any occurrence of a string and replace each occurrence by a C string.
- Parameters
-
find The string to find. replace The C string to replace.
- Returns
- The number of replaced occurrences.
References Begin(), GetLength(), and Replace().
◆ Replace() [5/5]
Find any occurrence of a C string and replace each occurrence by a string.
- Parameters
-
find The C string to find. replace The string to replace.
- Returns
- The number of replaced occurrences.
References Begin(), GetLength(), and Replace().
◆ Find() [1/4]
Find a character.
Verify (assert in debug build) 'from' against the string length.
- Parameters
-
charCode The character to find. from The byte position to start.
- Returns
- The byte position of the character or -1 if not found.
Referenced by Find().
◆ Find() [2/4]
Find a C string & length.
Verify (assert in debug build) 'from' against the string length.
- Parameters
-
length The number of bytes to find. str The C string to find. from The byte position to start.
- Returns
- The byte position of the string or -1 if not found.
◆ Find() [3/4]
Find a C string.
- Parameters
-
str The C string to find. from The byte position to start.
- Returns
- The byte position of the string or -1 if not found.
References Find().
◆ Find() [4/4]
Find a string.
- Parameters
-
str The string to find. from The byte position to start.
- Returns
- The byte position of the string or -1 if not found.
References Begin(), Find(), and GetLength().
◆ ReverseFind() [1/7]
Find a character from right to left.
Verify (assert in debug build) 'from' against the string length.
- Parameters
-
charCode The character to find. from The byte position to start.
- Returns
- The byte position of the character or -1 if not found.
Referenced by ReverseFind().
◆ ReverseFind() [2/7]
Find a character from right to left.
- Parameters
-
charCode The character to find.
- Returns
- The byte position of the character or -1 if not found.
References GetLength(), and ReverseFind().
◆ ReverseFind() [3/7]
Find a C string & length from right to left at position.
Verify (assert in debug build) 'from' against the string length.
- Parameters
-
length The number of bytes to find. str The C string to find. from The byte position to start.
- Returns
- The byte position of the character or -1 if not found.
◆ ReverseFind() [4/7]
Find a C string from right to left at position.
- Parameters
-
str The C string to find. from The byte position to start.
- Returns
- The byte position of the string or -1 if not found.
References ReverseFind().
◆ ReverseFind() [5/7]
Find a string from right to left at position.
- Parameters
-
str The string to find. from The byte position to start.
- Returns
- The byte position of the string or -1 if not found.
References Begin(), GetLength(), and ReverseFind().
◆ ReverseFind() [6/7]
Find a C string from right to left.
- Parameters
-
str The C string to find.
- Returns
- The byte position of the string or -1 if not found.
References GetLength(), and ReverseFind().
◆ ReverseFind() [7/7]
Find a string from right to left.
- Parameters
-
str The string to find.
- Returns
- The byte position of the string or -1 if not found.
References GetLength(), and ReverseFind().
◆ FindFirstOf() [1/3]
Find first character from a character set C string & length.
Verify (assert in debug build) 'from' against the string length.
- Parameters
-
length The number of bytes in the C string. str The character set C string. from The byte position to start.
- Returns
- The byte position of a matching character or -1 if not found.
Referenced by FindFirstOf().
◆ FindFirstOf() [2/3]
Find first character from a character set C string.
- Parameters
-
str The character set C string. from The byte position to start.
- Returns
- The byte position of a matching character or -1 if not found.
References FindFirstOf().
◆ FindFirstOf() [3/3]
Find first character from a character set string.
- Parameters
-
str The character set string. from The byte position to start.
- Returns
- The byte position of a matching character or -1 if not found.
References Begin(), FindFirstOf(), and GetLength().
◆ FindFirstNotOf() [1/3]
Find the first character not matching any of the characters in a given set.
Verify (assert in debug build) 'from' against the string length.
- Parameters
-
length The number of bytes in the given C string character set. str The character set C string. from The byte position to start.
- Returns
- The byte position of the first non-matching character or -1 if not found.
Referenced by FindFirstNotOf().
◆ FindFirstNotOf() [2/3]
Find the first character not matching any of the characters in a given set.
- Parameters
-
str The character set C string. from The byte position to start.
- Returns
- The byte position of a matching character or -1 if not found.
References FindFirstNotOf().
◆ FindFirstNotOf() [3/3]
Find the first character not matching any of the characters in a given set.
- Parameters
-
str The character set string. from The byte position to start.
- Returns
- The byte position of a matching character or -1 if not found.
References Begin(), FindFirstNotOf(), and GetLength().
◆ StartsWith() [1/3]
Check if the start matches a C string & length.
- Parameters
-
str The C string to match. length The number of bytes to match.
- Returns
- true if the start matches the string.
References Begin(), GetLength(), and Murl::System::CLib::MemCompare().
Referenced by StartsWith().
◆ StartsWith() [2/3]
Check if the start matches a C string.
- Parameters
-
str The C string to match.
- Returns
- true if the start matches the string.
References StartsWith().
◆ StartsWith() [3/3]
Check if the start matches a string.
- Parameters
-
str The string to match.
- Returns
- true if the start matches the string.
References Begin(), GetLength(), and StartsWith().
◆ EndsWith() [1/3]
Check if the end matches a C string & length.
- Parameters
-
str The C string to match. length The number of bytes to match.
- Returns
- true if the end matches the string.
References Begin(), GetLength(), and Murl::System::CLib::MemCompare().
Referenced by EndsWith().
◆ EndsWith() [2/3]
Check if the end matches a C string.
- Parameters
-
str The C string to match.
- Returns
- true if the end matches the string.
References EndsWith().
◆ EndsWith() [3/3]
Check if the end matches a string.
- Parameters
-
str The string to match.
- Returns
- true if the end matches the string.
References Begin(), EndsWith(), and GetLength().
◆ Compare() [1/2]
Compare a C string.
- Parameters
-
str The C string to compare.
- Returns
- return -1 if lower, 0 if equal, 1 if greater.
Referenced by IsEqual().
◆ Compare() [2/2]
Compare a string.
- Parameters
-
str The string to compare.
- Returns
- return -1 if lower, 0 if equal, 1 if greater.
◆ IsEqual() [1/2]
Check if a C string is equal.
- Parameters
-
str The C string to compare.
- Returns
- return true if equal.
References Compare().
◆ IsEqual() [2/2]
Check if a string is equal.
- Parameters
-
str The string to compare.
- Returns
- return true if equal.
◆ GetHashValue()
UInt32 Murl::String::GetHashValue | ( | ) | const |
Calculate the string hash value.
- Returns
- The hash value.
◆ GetAlloc()
|
inline |
Get the number of allocated bytes for characters, excluding the zero terminator.
- Returns
- The number of allocated bytes for characters.
◆ GetLength()
|
inline |
Get number of byte characters.
- Returns
- The number of byte characters.
Referenced by Cat(), End(), EndsWith(), Find(), FindFirstNotOf(), FindFirstOf(), Insert(), IsEmpty(), Last(), Mid(), operator=(), Murl::ConstData::operator==(), Replace(), Reserve(), ReverseFind(), Right(), Shrink(), and StartsWith().
◆ IsEmpty()
|
inline |
Check if the string is empty.
- Returns
- true if the string is empty.
References GetLength().
Referenced by Murl::Logic::GraphObservableNode< NodeType >::FindNode(), Murl::Util::ClassInfoRegistry< ClassInfoType >::Register(), and Murl::Util::ClassInfoRegistry< ClassInfoType >::Unregister().
◆ ToString()
|
inline |
Get a const reference of the string.
Convenience method for Lua scripting support.
- Returns
- The string reference.
◆ Begin()
|
inline |
Get the pointer to the first character.
- Returns
- The read-only pointer to the first character.
Referenced by Cat(), Murl::Logic::GraphObservableNode< NodeType >::CreateTypedNode(), End(), EndsWith(), Murl::Util::MessageMethod< MessageClass, ObjectClass >::Execute(), Find(), FindFirstNotOf(), FindFirstOf(), Murl::Logic::GraphObservableNode< NodeType >::FindNode(), Murl::IAttributes::GetEnumValueByIndex(), Last(), operator const Char *(), operator const UInt8 *(), operator const void *(), operator*(), operator=(), Murl::ConstData::operator==(), Replace(), ReverseFind(), Shrink(), StartsWith(), String(), and Murl::Logic::GraphObservableNode< NodeType >::TrackReference().
◆ End()
|
inline |
Get the pointer to the end of the string.
- Returns
- The read-only pointer to end of the string.
References Begin(), and GetLength().
◆ Last()
|
inline |
Get the pointer to the last character.
- Returns
- The read-only pointer to the last character.
References Begin(), and GetLength().
◆ operator const Char *()
|
inline |
◆ operator const UInt8 *()
|
inline |
◆ operator const void *()
|
inline |
◆ operator[]()
The array operator.
Verify (assert in debug build) 'pos' against the string length.
- Parameters
-
pos The character byte position.
- Returns
- The character at the specified position, if the position is out of range 0 is returned.
◆ operator*()
|
inline |
◆ operator=() [1/3]
Assignment operator for C string.
- Parameters
-
str The C string to assign.
- Returns
- The object itself.
References Begin(), GetLength(), and String().
◆ operator=() [2/3]
Assignment operator for string.
- Parameters
-
str The string to assign.
- Returns
- The object itself.
◆ operator=() [3/3]
Move operator for string.
- Parameters
-
str The string to assign.
- Returns
- The object itself.
References Swap().
◆ operator+=() [1/11]
In-place addition operator for a character.
- Parameters
-
chr The character to add.
- Returns
- The object itself.
References Cat().
◆ operator+=() [2/11]
In-place addition operator for const C string.
- Parameters
-
str The C string to add.
- Returns
- The string itself.
References Cat().
◆ operator+=() [3/11]
In-place addition operator for string.
- Parameters
-
str The string to add.
- Returns
- The string itself.
References Cat().
◆ operator+=() [4/11]
In-place addition operator for UInt64.
- Parameters
-
value The value to add.
- Returns
- The string itself.
◆ operator+=() [5/11]
In-place addition operator for SInt64.
- Parameters
-
value The value to add.
- Returns
- The string itself.
◆ operator+=() [6/11]
In-place addition operator for UInt32.
- Parameters
-
value The value to add.
- Returns
- The string itself.
◆ operator+=() [7/11]
In-place addition operator for SInt32.
- Parameters
-
value The value to add.
- Returns
- The string itself.
◆ operator+=() [8/11]
In-place addition operator for Double.
- Parameters
-
value The value to add.
- Returns
- The string itself.
◆ operator+=() [9/11]
◆ operator+=() [10/11]
In-place addition operator for Bool.
- Parameters
-
value The value to add.
- Returns
- The string itself.
◆ operator+=() [11/11]
const String& Murl::String::operator+= | ( | const System::Time & | value | ) |
◆ Swap()
void Murl::String::Swap | ( | String & | other | ) |
Exchange the content of the string with a given second one.
- Parameters
-
other The second string.
Referenced by operator=(), and String().
Friends And Related Function Documentation
◆ operator+ [1/13]
Addition operator for string and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side string.
- Returns
- The concatenated string.
◆ operator+ [2/13]
Addition operator for string and C string.
- Parameters
-
lhs The left hand side string. rhs The right hand side C string.
- Returns
- The concatenated string.
◆ operator+ [3/13]
Addition operator for C string and string.
- Parameters
-
lhs The left hand side C string. rhs The right hand side string.
- Returns
- The concatenated string.
◆ operator+ [4/13]
Addition operator for string and character.
- Parameters
-
lhs The left hand side string. rhs The right hand side character.
- Returns
- The concatenated string.
◆ operator+ [5/13]
Addition operator for character and string.
- Parameters
-
lhs The left hand side character. rhs The right hand side string.
- Returns
- The concatenated string.
◆ operator+ [6/13]
Addition operator for UInt64 and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side variable.
- Returns
- The concatenated string.
◆ operator+ [7/13]
Addition operator for SInt64 and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side variable.
- Returns
- The concatenated string.
◆ operator+ [8/13]
Addition operator for UInt32 and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side variable.
- Returns
- The concatenated string.
◆ operator+ [9/13]
Addition operator for SInt32 and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side variable.
- Returns
- The concatenated string.
◆ operator+ [10/13]
Addition operator for Double and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side variable.
- Returns
- The concatenated string.
◆ operator+ [11/13]
Addition operator for Color and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side variable.
- Returns
- The concatenated string.
◆ operator+ [12/13]
Addition operator for Bool and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side variable.
- Returns
- The concatenated string.
◆ operator+ [13/13]
|
friend |
Addition operator for Time and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side variable.
- Returns
- The concatenated string.
◆ operator< [1/3]
Less than operator for string and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side string.
- Returns
- true if the left hand string is less than the right hand string.
◆ operator< [2/3]
Less than operator for string and C string.
- Parameters
-
lhs The left hand side string. rhs The right hand side C string.
- Returns
- true if the left hand string is less than the right hand string.
◆ operator< [3/3]
Less than operator for C string and string.
- Parameters
-
lhs The left hand side C string. rhs The right hand side string.
- Returns
- true if the left hand string is less than the right hand string.
◆ operator<= [1/3]
Less than or equal to operator for string and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side string.
- Returns
- true if the left hand string is less than or equal to the right hand string.
◆ operator<= [2/3]
Less than or equal to operator for string and C string.
- Parameters
-
lhs The left hand side string. rhs The right hand side C string.
- Returns
- true if the left hand string is less than or equal to the right hand string.
◆ operator<= [3/3]
Less than or equal to operator for C string and string.
- Parameters
-
lhs The left hand side C string. rhs The right hand side string.
- Returns
- true if the left hand string is less than or equal to the right hand string.
◆ operator> [1/3]
Greater than operator for string and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side string.
- Returns
- true if the left hand string is greater than the right hand string.
◆ operator> [2/3]
Greater than operator for string and C string.
- Parameters
-
lhs The left hand side string. rhs The right hand side C string.
- Returns
- true if the left hand string is greater than the right hand string.
◆ operator> [3/3]
Greater than operator for C string and string.
- Parameters
-
lhs The left hand side C string. rhs The right hand side string.
- Returns
- true if the left hand string is greater than the right hand string.
◆ operator>= [1/3]
Greater than or equal to operator for string and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side string.
- Returns
- true if the left hand string is greater than or equal to the right hand string.
◆ operator>= [2/3]
Greater than or equal to operator for string and C string.
- Parameters
-
lhs The left hand side string. rhs The right hand side C string.
- Returns
- true if the left hand string is greater than or equal to the right hand string.
◆ operator>= [3/3]
Greater than or equal to operator for C string and string.
- Parameters
-
lhs The left hand side C string. rhs The right hand side string.
- Returns
- true if the left hand string is greater than or equal to the right hand string.
◆ operator== [1/3]
Equal to comparison operator for string and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side string.
- Returns
- true if the strings are equal.
◆ operator== [2/3]
Equal to comparison operator for string and C string.
- Parameters
-
lhs The left hand side string. rhs The right hand side C string.
- Returns
- true if the strings are equal.
◆ operator== [3/3]
Equal to comparison operator for C string and string.
- Parameters
-
lhs The left hand side C string. rhs The right hand side string.
- Returns
- true if the strings are equal.
◆ operator!= [1/3]
Not equal to comparison operator for string and string.
- Parameters
-
lhs The left hand side string. rhs The right hand side string.
- Returns
- true if the strings are not equal.
◆ operator!= [2/3]
Not equal to comparison operator for string and C string.
- Parameters
-
lhs The left hand side string. rhs The right hand side C string.
- Returns
- true if the strings are not equal.
◆ operator!= [3/3]
Not equal to comparison operator for C string and string.
- Parameters
-
lhs The left hand side C string. rhs The right hand side string.
- Returns
- true if the strings are not equal.
The documentation for this class was generated from the following file:
- murl_string.h