libcommonc++
0.7
|
A flexible, reference counted, copy-on-write, thread-safe, nullable string. More...
#include <String.h++>
Public Types | |
typedef char16_t | value_type |
typedef const char16_t * | const_iterator |
Public Member Functions | |
String () | |
Construct a new, empty string. More... | |
String (const String &other) | |
Copy constructor. More... | |
String (char16_t *str, uint_t offset=0, uint_t count=0, bool copy=true) | |
Construct a new string from a C string. More... | |
String (const char16_t *str, uint_t offset=0, uint_t count=0) | |
Construct a new string from an array of UTF-16 characters. More... | |
String (const wchar_t *str) | |
Construct a new string from a C wide string. More... | |
String (const char *str, uint_t offset=0, uint_t count=0) | |
Construct a new string from a C string encoded in UTF-8. More... | |
~String () | |
Destructor. More... | |
bool | endsWith (const String &str, bool ignoreCase=false) const |
Test if the string ends with the given string. More... | |
bool | endsWith (const Char &c, bool ignoreCase=false) const |
Test if the string ends with the given character. More... | |
bool | endsWithAnyOf (const String &chars, bool ignoreCase=false) const |
Test if the string ends with any character in a given set of characters. More... | |
bool | startsWith (const String &str, bool ignoreCase=false) const |
Test if the string starts with the given string. More... | |
bool | startsWith (const Char &c, bool ignoreCase=false) const |
Test if the string starts with the given character. More... | |
bool | startsWithAnyOf (const String &chars, bool ignoreCase=false) const |
Test if the string starts with any character in a given set of characters. More... | |
uint_t | getLength () const |
Get the length of the string. More... | |
uint_t | length () const |
Get the length of the string. More... | |
void | setLength (uint_t length) |
Set the length of the string. More... | |
void | reserve (uint_t capacity) |
Reserve space in the string for the given number of characters. More... | |
uint_t | getCapacity () const |
Get the current capacity of the string, in characters. More... | |
void | compact () |
Compact the string so that it occupies the minimum amount of memory required. More... | |
String & | clear () |
Clear the string. More... | |
bool | isEmpty () const |
Test if the string is empty. More... | |
bool | isNull () const |
Test if the string is null. More... | |
bool | isInteger () const |
Test if the string holds an integer. More... | |
bool | isAlphaNumeric () const |
Test if the string consists solely of alphanumeric characters. More... | |
int | compareTo (const String &other, bool ignoreCase=false) const |
Compare the string to another. More... | |
String & | trim (const String &chars=whitespaceChars, bool begin=true, bool end=true) |
Trim leading and trailing characters from the string. More... | |
String & | trimBegin (const String &chars=whitespaceChars) |
Trim characters from the beginning of the string. More... | |
String & | trimEnd (const String &chars=whitespaceChars) |
Trim characters from the end of the string. More... | |
String & | chop (const Char &c) |
Truncate the string at the first occurrence of the given character. More... | |
String & | reverseChop (const Char &c) |
Truncate the string at the last occurrence of the given character. More... | |
String & | replace (const Char &a, const Char &b) |
Replace all occurences of one character with another. More... | |
String & | replace (const String &a, const String &b) |
Replace all occurences of one substring with another. More... | |
String & | insert (const Char &c, uint_t index=0) |
Insert a character into the string. More... | |
String & | insert (const String &str, uint_t index=0, uint_t length=0) |
Insert a string into this string. More... | |
String & | insert (const char16_t *str, uint_t index=0, uint_t count=0) |
Insert a UTF-16 character array into this string. More... | |
String & | insert (const wchar_t *str, uint_t index=0, uint_t count=0) |
Insert a C wide string to this string. More... | |
String & | insert (const char *str, uint_t index=0, uint_t count=0) |
Insert a C string to this string. More... | |
String & | append (bool v) |
Append a string representation of a boolean value to the end of the string. More... | |
String & | append (char c) |
Append a character to the end of the string. More... | |
String & | append (char16_t c) |
Append a UTF-16 character to the end of the string. More... | |
String & | append (int val) |
Append a string representation of an integer value onto the end of the string. More... | |
String & | append (int val, uint_t base) |
Append a string representation of an integer value in the given base onto the end of the string. More... | |
String & | append (uint_t val) |
Append a string representation of an unsigned integer value onto the end of the string. More... | |
String & | append (uint_t val, uint_t base) |
Append a string representation of an unsigned integer value in the given base onto the end of the string. More... | |
String & | append (const int64_t &val) |
Append a string representation of a long long (64-bit) integer onto the end of the string. More... | |
String & | append (const double &val, uint_t precision=6) |
Append a string representation of double-precision floating point value onto the end of the string. More... | |
String & | append (const uint64_t &val) |
Append a string representation of an unsigned long long (64-bit) integer onto the end of the string. More... | |
String & | append (const Char &c) |
Append a character to the end of the string. More... | |
String & | append (const String &str, uint_t count=0) |
Append a string to the end of the string. More... | |
String & | append (const char16_t *str, uint_t count=0) |
Append a UTF-16 character array to the end of the string. More... | |
String & | append (const char *str, uint_t count=0) |
Append a string to the end of the string. More... | |
String & | append (const wchar_t *str, uint_t count=0) |
Append a wide string to the end of the string. More... | |
String & | prepend (char c) |
Prepend a character to the beginning of the string. More... | |
String & | prepend (char16_t c) |
Prepend a character to the beginning of the string. More... | |
String & | prepend (const Char &c) |
Prepend a character to the beginning of the string. More... | |
String & | prepend (const String &str, uint_t count=0) |
Prepend a string to the beginning of the string. More... | |
String & | prepend (const char16_t *str, uint_t count=0) |
Prepend a string to the beginning of the string. More... | |
String & | prepend (const char *str, uint_t count=0) |
Prepend a string to the beginning of the string. More... | |
String & | prepend (const wchar_t *str, uint_t count=0) |
Prepend a wide string to the beginning of the string. More... | |
String & | remove (uint_t fromIndex, uint_t toIndex=END) |
Remove a portion of the string. More... | |
Char | charAt (uint_t index) const |
Return the character at the given index. More... | |
String & | setCharAt (uint_t index, const Char &c) |
Set the character at the given index. More... | |
uint_t | hash (uint_t modulo=256) const |
Compute a hashcode for the string. More... | |
String | substring (uint_t fromIndex, uint_t toIndex=END) const |
Extract a substring from the string. More... | |
int | indexOf (const Char &c, uint_t fromIndex=0) const |
Find the first occurrence of a given character in the string. More... | |
int | indexOf (const char *str, uint_t fromIndex=0) const |
Find the first occurrence of a given string in this string. More... | |
int | indexOfAnyOf (const String &chars, uint_t fromIndex=0) const |
Find the first occurrence in this string of any character in a set of characters. More... | |
int | indexOf (const String &str, uint_t fromIndex=0) const |
Find the first occurrence of a given string in this string. More... | |
int | lastIndexOf (const Char &c, uint_t fromIndex=END) const |
Find the last occurrence of a given character in this string. More... | |
int | lastIndexOfAnyOf (const String &chars, uint_t fromIndex=END) const |
Find the last occurrence in the string of any character in a set of characters. More... | |
int | lastIndexOf (const String &str, uint_t fromIndex=END) const |
Find the last occurrence of a given string in this string. More... | |
bool | contains (const Char &c) const |
Determine if the string contains a given character. More... | |
bool | contains (const String &str) const |
Determine if the string contains a given substring. More... | |
bool | containsAnyOf (const char *chars) const |
Determine if the string contains any character in a given set of characters. More... | |
String | nextToken (uint_t &fromIndex, const String &delim=whitespaceChars) const |
Extract a token from the string. More... | |
uint_t | split (StringVec &tokens, const String &delim=whitespaceChars, uint_t limit=0) const |
Split the string into a series of tokens, without modifying the string. More... | |
String & | toLowerCase () |
Convert the string to lower case. More... | |
String & | toUpperCase () |
Convert the string to upper case. More... | |
String & | fill (const Char &c, uint_t count) |
Fill the string with a character. More... | |
String & | pad (const Char &c, uint_t count) |
Pad the string with a character. More... | |
bool | toBool (uint_t index=0) const |
Parse a boolean value from the string. More... | |
int | toInt (uint_t index=0, uint_t base=10) const |
Parse an integer from the string. More... | |
uint_t | toUInt (uint_t index=0, uint_t base=10) const |
Parse an unsigned integer from the string. More... | |
int64_t | toInt64 (uint_t index=0, uint_t base=10) const |
Parse a 64-bit integer from the string. More... | |
uint64_t | toUInt64 (uint_t index=0, uint_t base=10) const |
Parse an unsigned 64-bit integer from the string. More... | |
float | toFloat (uint_t index=0) const |
Parse a floating point value from the string. More... | |
double | toDouble (uint_t index=0) const |
Parse a double precision floating point value from the string. More... | |
operator const void * () const | |
Pointer cast operator. More... | |
const char16_t * | data () const |
Returns a pointer to the UTF-16 data for this string. More... | |
CString | toUTF8 () const |
Return the contents of the string as an immutable C string. More... | |
String & | operator= (const char *other) |
Assignment operator. More... | |
String & | operator= (const wchar_t *other) |
Assignment operator. More... | |
String & | operator= (const String &other) |
Assignment operator. More... | |
String & | operator= (const std::string &other) |
Assignment operator. More... | |
CharRef | operator[] (int index) |
Array index operator. More... | |
const Char | operator[] (int index) const |
Array index operator. More... | |
const_iterator | begin () const |
Return a const_iterator to the beginning of the string. More... | |
const_iterator | end () const |
Return a const_iterator to the end of the string. More... | |
String | operator() (uint_t fromIndex, uint_t toIndex=END) const |
Substring operator. More... | |
bool | operator! () const |
Unary NOT operator. More... | |
String & | operator+= (char c) |
Append a character onto the end of the string. More... | |
String & | operator+= (char16_t c) |
Append a UTF-16 character onto the end of the string. More... | |
String & | operator+= (const Char &c) |
Append a character onto the end of the string. More... | |
String & | operator+= (const char *str) |
Append a C string onto the end of this string. More... | |
String & | operator+= (const String &str) |
Append a string onto the end of this string. More... | |
String & | operator+= (bool val) |
Append a string representation of a boolean value onto the end of the string. More... | |
String & | operator+= (int val) |
Append a string representation of an integer value onto the end of the string. More... | |
String & | operator+= (uint_t val) |
Append a string representation of an unsigned integer value onto the end of the string. More... | |
String & | operator+= (double val) |
Append a string representation of double-precision floating point value onto the end of the string. More... | |
String & | operator+= (int64_t val) |
Append a string representation of a long long (64-bit) integer onto the end of the string. More... | |
String & | operator+= (uint64_t val) |
Append a string representation of an unsigned long long (64-bit) integer onto the end of the string. More... | |
String & | operator<< (const char *str) |
Append operator. More... | |
String & | operator<< (const wchar_t *str) |
Append operator. More... | |
String & | operator<< (const String &str) |
Append operator. More... | |
String & | operator<< (bool val) |
Append operator. More... | |
String & | operator<< (char c) |
Append operator. More... | |
String & | operator<< (char16_t c) |
Append operator. More... | |
String & | operator<< (const Char &c) |
Append operator. More... | |
String & | operator<< (int val) |
Append operator. More... | |
String & | operator<< (uint_t val) |
Append operator. More... | |
String & | operator<< (const int64_t &val) |
Append operator. More... | |
String & | operator<< (const uint64_t &val) |
Append operator. More... | |
String & | operator<< (const double &val) |
Append operator. More... | |
String & | operator^= (char c) |
Prepend operator. More... | |
String & | operator^= (char16_t c) |
Prepend operator. More... | |
String & | operator^= (const Char &c) |
Prepend operator. More... | |
String & | operator^= (const char *str) |
Prepend operator. More... | |
String & | operator^= (const wchar_t *str) |
Prepend operator. More... | |
String & | operator^= (const String &str) |
Prepend operator. More... | |
String | operator+ (const String &str) |
String | operator+ (const char *str) |
String | operator+ (const Char &c) |
void | write (std::ostream &stream) const |
Write the string (in UTF-8 form) to a stream. More... | |
Static Public Attributes | |
static const uint_t | END = ~0 |
A pseudo-index indicating the end of the string. More... | |
static const String | null = String() |
The null string. More... | |
static const String | nullRep = String("(null)") |
The string representation of the null value. More... | |
static const String | empty = "" |
The empty string. More... | |
static const String | whitespaceChars = " \t\f\r\n\v" |
The set of whitespace delimiter characters. More... | |
A flexible, reference counted, copy-on-write, thread-safe, nullable string.
typedef const char16_t* const_iterator |
typedef char16_t value_type |
String | ( | ) |
Construct a new, empty string.
Construct a new string from a C string.
str | The C string to copy or inherit. |
offset | The number of characters from the beginning of the string to skip over. |
count | The number of characters from the offset to use, or 0 to use all the characters to the end of the string. |
copy | If true, the C string is copied into the String; otherwise the C string is inherited and the length parameter is ignored. |
Construct a new string from an array of UTF-16 characters.
The array is copied into the string.
str | The character array. |
offset | The number of characters from the beginning of the string to skip over. |
count | The number of characters from the offset to use, or 0 to use all the characters to the end of the string. |
String | ( | const wchar_t * | str | ) |
Construct a new string from a C wide string.
str | The C wide string. |
EncodingException | If the string contains invalid code points. |
Construct a new string from a C string encoded in UTF-8.
str | The C string. |
offset | The number of characters from the beginning of the string to skip over. |
count | The number of characters from the offset to use, or 0 to use all the characters to the end of the string. |
EncodingException | If the string does not contain valid UTF-8. |
~String | ( | ) |
Destructor.
String & append | ( | bool | v | ) |
Append a string representation of a boolean value to the end of the string.
v | The value to append. |
|
inline |
Append a character to the end of the string.
c | The character to append. |
Append a UTF-16 character to the end of the string.
c | The character to append. |
String & append | ( | int | val | ) |
Append a string representation of an integer value onto the end of the string.
val | The value to append. |
Append a string representation of an integer value in the given base onto the end of the string.
val | The value to append. |
base | The numerical base in which to output the value. The valid range is 2 - 36, inclusive. |
Append a string representation of an unsigned integer value onto the end of the string.
val | The value to append. |
Append a string representation of an unsigned integer value in the given base onto the end of the string.
val | The value to append. |
base | The numerical base in which to output the value. The valid range is 2 - 36, inclusive. |
String & append | ( | const int64_t & | val | ) |
Append a string representation of a long long (64-bit) integer onto the end of the string.
val | The value to append. |
Append a string representation of double-precision floating point value onto the end of the string.
val | The value to append. |
precision | The precision (the number of digits to include after the radix). |
String & append | ( | const uint64_t & | val | ) |
Append a string representation of an unsigned long long (64-bit) integer onto the end of the string.
val | The value to append. |
Append a character to the end of the string.
c | The character to append. |
Append a string to the end of the string.
str | The character to append. |
count | The maximum number of characters from str to append, or 0 to append all of str. |
Append a UTF-16 character array to the end of the string.
str | The character array to append. |
count | The maximum number of characters from str to append, or 0 to append all of str. |
Append a string to the end of the string.
str | The string to append. |
count | The maximum number of characters from str to append, or 0 to append all of str. |
Append a wide string to the end of the string.
str | The string to append. |
count | The maximum number of characters from str to append, or 0 to append all of str. |
String::const_iterator begin | ( | ) | const |
Return a const_iterator to the beginning of the string.
NullPointerException | If the string is null. |
Return the character at the given index.
index | The index. |
OutOfBoundsException | If index is out of range. |
Truncate the string at the first occurrence of the given character.
c | The character at which to truncate. |
|
inline |
Clear the string.
Sets the length of the string to 0.
void compact | ( | ) |
Compact the string so that it occupies the minimum amount of memory required.
int compareTo | ( | const String & | other, |
bool | ignoreCase = false |
||
) | const |
Compare the string to another.
other | The string to compare to. |
ignoreCase | A flag indicating whether the compare should be case insensitive. |
|
inline |
Determine if the string contains a given character.
c | The character to search for. |
|
inline |
Determine if the string contains a given substring.
str | The substring to search for. |
|
inline |
Determine if the string contains any character in a given set of characters.
chars | The set of characters. |
const char16_t * data | ( | ) | const |
Returns a pointer to the UTF-16 data for this string.
String::const_iterator end | ( | ) | const |
Return a const_iterator to the end of the string.
NullPointerException | If the string is null. |
bool endsWith | ( | const String & | str, |
bool | ignoreCase = false |
||
) | const |
Test if the string ends with the given string.
str | The other string. |
ignoreCase | A flag indicating whether the comparison should be case-insensitive. |
bool endsWith | ( | const Char & | c, |
bool | ignoreCase = false |
||
) | const |
Test if the string ends with the given character.
c | The character. |
ignoreCase | A flag indicating whether the comparison should be case-insensitive. |
bool endsWithAnyOf | ( | const String & | chars, |
bool | ignoreCase = false |
||
) | const |
Test if the string ends with any character in a given set of characters.
chars | The set of characters. |
ignoreCase | A flag indicating whether the comparison should be case-insensitive. |
Fill the string with a character.
c | The fill character. |
count | The number of characters to fill. |
uint_t getCapacity | ( | ) | const |
Get the current capacity of the string, in characters.
This value takes into account the space required for the final NUL terminator.
uint_t getLength | ( | ) | const |
Get the length of the string.
Compute a hashcode for the string.
modulo | The desired range for the hashcode. |
Find the first occurrence of a given character in the string.
c | The character to search for. |
fromIndex | The start index from which to begin searching. |
|
inline |
Find the first occurrence of a given string in this string.
str | The string to search for. |
fromIndex | The start index from which to begin searching. |
Find the first occurrence of a given string in this string.
str | The string to search for. |
fromIndex | The start index from which to begin searching. |
Find the first occurrence in this string of any character in a set of characters.
chars | The set of characters search for. |
fromIndex | The start index from which to begin searching. |
Insert a character into the string.
c | The character to insert. |
index | The index at which to insert the character. If the index is out of range, the character is appended to the end of the string. |
Insert a string into this string.
str | The string to insert. |
index | The index at which to insert the string. If the index is out of range, the string is appended to the end of this string. |
length | The maximum number of characters from str to insert. |
Insert a UTF-16 character array into this string.
str | The array to insert. |
index | The index at which to insert the characters. If the index is out of range, the characters are appended to the end of this string. |
count | The number of characters from str to insert. |
Insert a C wide string to this string.
str | The C wide string to insert. |
index | The index at which to insert the string. If the index is out of range, the string is appended to the end of this string. |
count | The maximum number of characters from str to insert. |
Insert a C string to this string.
str | The C wide string to insert. |
index | The index at which to insert the string. If the index is out of range, the string is appended to the end of this string. |
count | The maximum number of characters from str to insert. |
bool isAlphaNumeric | ( | ) | const |
Test if the string consists solely of alphanumeric characters.
bool isEmpty | ( | ) | const |
Test if the string is empty.
bool isInteger | ( | ) | const |
Test if the string holds an integer.
For example, "123", "+5", and "-123" are integers.
bool isNull | ( | ) | const |
Test if the string is null.
Find the last occurrence of a given character in this string.
c | The character to search for. |
fromIndex | The index from which to begin searching backwards, or END to start at the end of the string. |
Find the last occurrence of a given string in this string.
str | The string to search for. |
fromIndex | The index from which to begin searching backwards, or END to start at the end of the string. |
Find the last occurrence in the string of any character in a set of characters.
chars | The set of characters search for. |
fromIndex | The index from which to begin searching backwards, or END to start at the end of the string. |
|
inline |
Get the length of the string.
String nextToken | ( | uint_t & | fromIndex, |
const String & | delim = whitespaceChars |
||
) | const |
Extract a token from the string.
fromIndex | The start index at which to begin searching for a token. Will be modified on return to point to one character past the extracted token. |
delim | The set of possible token delimiter characters (the set of whitespace characters by default). |
operator const void * | ( | ) | const |
Pointer cast operator.
|
inline |
Unary NOT operator.
Substring operator.
Extract a substring from the string.
fromIndex | The start index of the substring. |
toIndex | The end index of the substring, or END to indicate the end of the string. |
String operator+ | ( | const char * | str | ) |
|
inline |
Append a character onto the end of the string.
c | The character to append. |
Append a UTF-16 character onto the end of the string.
c | The character to append. |
Append a character onto the end of the string.
c | The character to append. |
|
inline |
Append a C string onto the end of this string.
str | The string to append. |
Append a string onto the end of this string.
str | The string to append. |
|
inline |
Append a string representation of a boolean value onto the end of the string.
val | The value to append. |
|
inline |
Append a string representation of an integer value onto the end of the string.
val | The value to append. |
Append a string representation of an unsigned integer value onto the end of the string.
val | The value to append. |
|
inline |
Append a string representation of double-precision floating point value onto the end of the string.
val | The value to append. |
|
inline |
Append a string representation of a long long (64-bit) integer onto the end of the string.
val | The value to append. |
|
inline |
Append a string representation of an unsigned long long (64-bit) integer onto the end of the string.
val | The value to append. |
|
inline |
Append operator.
|
inline |
Append operator.
|
inline |
Append operator.
|
inline |
Append operator.
|
inline |
Append operator.
|
inline |
Append operator.
|
inline |
Append operator.
|
inline |
Append operator.
String & operator= | ( | const char * | other | ) |
Assignment operator.
EncodingException | If the input is not valid UTF-8. |
String & operator= | ( | const wchar_t * | other | ) |
Assignment operator.
EncodingException | If the input contains invalid UTF-32 characters. |
|
inline |
Assignment operator.
EncodingException | If the input is not valid UTF-8. |
CharRef operator[] | ( | int | index | ) |
Array index operator.
Obtain a reference to the character at the given offset in the string.
index | The index. |
OutOfBoundsException | If index is out of range. |
const Char operator[] | ( | int | index | ) | const |
Array index operator.
Obtain a copy of the character at the given offset in the string.
index | The index. |
OutOfBoundsException | If index is out of range. |
|
inline |
Prepend operator.
|
inline |
Prepend operator.
|
inline |
Prepend operator.
Pad the string with a character.
c | The pad character. |
count | The number of characters to pad. |
|
inline |
Prepend a character to the beginning of the string.
c | The character to prepend. |
Prepend a character to the beginning of the string.
c | The character to prepend. |
Prepend a character to the beginning of the string.
c | The character to prepend. |
Prepend a string to the beginning of the string.
str | The character to prepend. |
count | The maximum number of characters from str to prepend, or 0 to prepend all of str. |
Prepend a string to the beginning of the string.
str | The character to prepend. |
count | The maximum number of characters from str to prepend, or 0 to prepend all of str. |
Prepend a string to the beginning of the string.
str | The character to prepend. |
count | The maximum number of characters from str to prepend, or 0 to prepend all of str. |
Prepend a wide string to the beginning of the string.
str | The character to prepend. |
count | The maximum number of characters from str to prepend, or 0 to prepend all of str. |
Remove a portion of the string.
fromIndex | The start index of the range to remove. |
toIndex | The end index of the range to remove, or END to remove to the end of the string. |
Replace all occurences of one character with another.
a | The character to replace. |
b | The replacement character. |
Replace all occurences of one substring with another.
a | The substring to replace. |
b | The replacement substring. |
void reserve | ( | uint_t | capacity | ) |
Reserve space in the string for the given number of characters.
If the new capacity is less than or equal to the current capacity, the string is not modified.
capacity | The new capacity. |
Truncate the string at the last occurrence of the given character.
c | The character at which to truncate. |
Set the character at the given index.
index | The index. |
c | The character to set. |
OutOfBoundsException | If index is out of range. |
void setLength | ( | uint_t | length | ) |
Set the length of the string.
Allows the string to be truncated to an arbitrary length.
length | The new length. The new length must be less than the current length; otherwise the string is left unmodified. |
uint_t split | ( | StringVec & | tokens, |
const String & | delim = whitespaceChars , |
||
uint_t | limit = 0 |
||
) | const |
Split the string into a series of tokens, without modifying the string.
tokens | The vector in which to place the extracted tokens. If a non-empty vector is supplied, the tokens are added to the end of the vector. |
delim | The set of possible token delimiter characters (the set of whitespace characters by default). |
limit | The maximum number of tokens to extract, or 0 for no limit (the default). |
bool startsWith | ( | const String & | str, |
bool | ignoreCase = false |
||
) | const |
Test if the string starts with the given string.
str | The other string. |
ignoreCase | A flag indicating whether the comparison should be case-insensitive. |
bool startsWith | ( | const Char & | c, |
bool | ignoreCase = false |
||
) | const |
Test if the string starts with the given character.
c | The character. |
ignoreCase | A flag indicating whether the comparison should be case-insensitive. |
bool startsWithAnyOf | ( | const String & | chars, |
bool | ignoreCase = false |
||
) | const |
Test if the string starts with any character in a given set of characters.
chars | The set of characters. |
ignoreCase | A flag indicating whether the comparison should be case-insensitive. |
Extract a substring from the string.
fromIndex | The start index of the substring. |
toIndex | The end index of the substring, or END to indicate the end of the string. |
bool toBool | ( | uint_t | index = 0 | ) | const |
Parse a boolean value from the string.
index | The index to begin parsing at. |
double toDouble | ( | uint_t | index = 0 | ) | const |
Parse a double precision floating point value from the string.
index | The index to begin parsing at. |
float toFloat | ( | uint_t | index = 0 | ) | const |
Parse a floating point value from the string.
index | The index to begin parsing at. |
Parse an integer from the string.
index | The index to begin parsing at. |
base | The base (2 - 36). |
Parse a 64-bit integer from the string.
index | The index to begin parsing at. |
base | The base (2 - 36). |
String & toLowerCase | ( | ) |
Convert the string to lower case.
Parse an unsigned integer from the string.
index | The index to begin parsing at. |
base | The base (2 - 36). |
Parse an unsigned 64-bit integer from the string.
index | The index to begin parsing at. |
base | The base (2 - 36). |
String & toUpperCase | ( | ) |
Convert the string to upper case.
CString toUTF8 | ( | ) | const |
Return the contents of the string as an immutable C string.
String & trim | ( | const String & | chars = whitespaceChars , |
bool | begin = true , |
||
bool | end = true |
||
) |
Trim leading and trailing characters from the string.
|
inline |
Trim characters from the beginning of the string.
chars | The set of characters to trim (the set of whitespace characters by default). |
|
inline |
Trim characters from the end of the string.
chars | The set of characters to trim (the set of whitespace characters by default). |
void write | ( | std::ostream & | stream | ) | const |
Write the string (in UTF-8 form) to a stream.
|
static |
The empty string.
|
static |
A pseudo-index indicating the end of the string.
|
static |
The set of whitespace delimiter characters.