TString¶
Inherited: None
Description¶
Public Methods¶
TString () |
|
TString (const ByteArray & array) |
|
TString (const std::string & str) |
|
TString (const char * str) |
|
TString (int n, const char ch) |
|
TString & |
append (const TString & str) |
TString & |
append (const std::string & str) |
TString & |
append (const char * str) |
TString & |
append (const char ch, int n) |
arg (const TString & arg1) const |
|
arg (const TString & arg1, const TString & arg2) const |
|
arg (const TString & arg1, const TString & arg2, const TString & arg3) const |
|
arg (const TString & arg1, const TString & arg2, const TString & arg3, const TString & arg4) const |
|
arg (const TString & arg1, const TString & arg2, const TString & arg3, const TString & arg4, const TString & arg5) const |
|
arg (const TString & arg1, const TString & arg2, const TString & arg3, const TString & arg4, const TString & arg5, const TString & arg6) const |
|
char |
at (int position) const |
char |
back () const |
void |
clear () |
int |
compare (const TString & other) const |
bool |
contains (const TString & str) const |
const char |
data () const |
char |
front () const |
int |
indexOf (const TString & str, uint32_t offset = 0) const |
int |
indexOf (const char ch, uint32_t offset = 0) const |
bool |
isEmpty () const |
int |
lastIndexOf (const TString & str) const |
int |
lastIndexOf (const char ch) const |
left (int n) const |
|
int |
length () const |
mid (int position, int n) const |
|
TString & |
remove (const TString & str) |
TString & |
remove (const char ch) |
TString & |
removeFirst () |
TString & |
removeLast () |
TString & |
replace (const TString & before, const TString & after) |
TString & |
replace (const char before, const char after) |
right (int n) const |
|
simplified () const |
|
int |
size () const |
StringList |
split (const char sep) const |
StringList |
split (const TString & sep) const |
bool |
startsWith (const TString & str) const |
ByteArray |
toByteArray () const |
float |
toFloat () const |
int |
toInt () const |
size_t |
toLong () const |
toLower () const |
|
const std::string |
toStdString () const |
std::wstring |
toStdWString () const |
toUpper () const |
|
std::u32string |
toUtf32 () const |
trimmed () const |
|
bool |
operator!= (const TString & other) const |
operator+ (const TString & other) const |
|
operator+ (const std::string & other) const |
|
operator+ (const char * other) const |
|
operator+ (char ch) const |
|
TString & |
operator+= (const TString & other) |
TString & |
operator+= (const std::string & str) |
TString & |
operator+= (const char * str) |
TString & |
operator+= (const char ch) |
bool |
operator< (const TString & other) const |
bool |
operator== (const TString & other) const |
char |
operator[] (int position) |
Static Methods¶
fromByteArray (const ByteArray & data, bool lineBreaks = false) |
|
fromUtf32 (const std::u32string & in) |
|
fromWc32 (uint32_t unicode) |
|
fromWString (const std::wstring & in) |
|
join (const StringList & list, const char * separator) |
|
number (long long in) |
|
number (int in) |
|
number (float in) |
Methods Description¶
TString::TString ()
Constructs an empty string.
TString::TString (ByteArray & array)
Constructs a string from a byte array.
TString::TString (std::string & str)
Constructs a string from a standard string.
TString::TString (char * str)
Constructs a string from a C-style null-terminated string.
TString::TString (int n, char ch)
Constructs a string of the given n size with every character set to ch.
Appends the string str onto the end of this string.
TString & TString::append (std::string & str)
Appends the standard string str onto the end of this string.
TString & TString::append (char * str)
Appends the string str to this string. The given const char pointer is converted to Unicode.
TString & TString::append (char ch, int n)
Appends a string of the given n size with every character set to ch.
Returns a copy of this string with the lowest-numbered place-marker %1 replaced by string arg1.
Returns a copy of this string with the lowest-numbered place-marker %1, %2 replaced by string arg1 and arg2.
Returns a copy of this string with the lowest-numbered place-marker %1, %2, %3 replaced by string arg1, arg2 and arg3.
Returns a copy of this string with the lowest-numbered place-marker %1, %2, %3, %4 replaced by string arg1, arg2, arg3 and arg4.
Returns a copy of this string with the lowest-numbered place-marker %1, %2, %3, %4, %5 replaced by string arg1, arg2, arg3, arg4 and arg5.
Returns a copy of this string with the lowest-numbered place-marker %1, %2, %3, %4, %5, %6 replaced by string arg1, arg2, arg3, arg4, arg5 and arg6.
char TString::at (int position) const
Returns the character at the given index position in the string.
char TString::back () const
Returns the last character in the string.
void TString::clear ()
Clears the contents of the string and makes it empty.
int TString::compare (TString & other) const
Compares this string with other string and returns a negative integer if this is less than other, a positive integer if it is greater than other, and zero if they are equal.
bool TString::contains (TString & str) const
Returns true if this string contains an occurrence of the string str; otherwise returns false.
const char TString::data () const
Returns a pointer to the data stored in the TString.
TString TString::fromByteArray (ByteArray & data, bool lineBreaks = false)
Encodes a ByteArray data into a Base64 string. If lineBreaks is true, line breaks are added every 76 characters.
See also toByteArray().
TString TString::fromUtf32 (std::u32string & in)
Returns a copy of the in string. The given string is assumed to be encoded in UTF-32.
TString TString::fromWc32 (uint32_t unicode)
Returns a TString initialized with the first size characters of the Unicode string unicode (encoded as UTF-32).
TString TString::fromWString (std::wstring & in)
Returns a copy of the in string. The given string is assumed to be encoded in utf16 if the size of wchar_t is 2 bytes (e.g. on windows).
char TString::front () const
Returns a reference to the first character in the string.
int TString::indexOf (TString & str, uint32_t offset = 0) const
Returns the index position of the first occurrence of the string str at specific offset in this string. Returns -1 if str is not found.
int TString::indexOf (char ch, uint32_t offset = 0) const
Returns the index position of the first occurrence of the character ch in this string. Returns -1 if ch is not found.
bool TString::isEmpty () const
Returns true if string is empty; otherwise returns false.
TString TString::join (StringList & list, char * separator)
Joins all the string list strings into a single string with each element separated by the given separator (which can be an empty string).
int TString::lastIndexOf (TString & str) const
Returns the index position of the last occurrence of the string str in this string, searching backward from index position from.
int TString::lastIndexOf (char ch) const
Returns the index position of the last occurrence of the character ch in this string, searching backward from index position from.
TString TString::left (int n) const
Returns a substring that contains the n leftmost characters of this string.
int TString::length () const
Returns the number of characters in this string.
TString TString::mid (int position, int n) const
Returns a string that contains n characters of this string, starting at the specified position index up to, but not including.
TString TString::number (long in)
Returns a string representing the long integer number in.
TString TString::number (int in)
Returns a string representing the integer number in.
TString TString::number (float in)
Returns a string representing the floating-point number in.
Removes every occurrence of the given str string in this string, and returns a reference to this string.
TString & TString::remove (char ch)
Removes every occurrence of the character ch in this string, and returns a reference to this string.
TString & TString::removeFirst ()
Removes the first character in this string. If the string is empty, this function does nothing.
TString & TString::removeLast ()
Removes the last character in this string. If the string is empty, this function does nothing.
Replaces every occurrence of the string before with the string after and returns a reference to this string.
TString & TString::replace (char before, char after)
Replaces every occurrence of the character before with the character after and returns a reference to this string.
TString TString::right (int n) const
Returns a substring that contains the n rightmost characters of the string.
TString TString::simplified () const
Returns a string that has whitespace removed from the start and the end, and that has each sequence of internal whitespace replaced with a single space.
int TString::size () const
Returns the number of characters in this string.
StringList TString::split (char sep) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
StringList TString::split (TString & sep) const
Splits the string into substrings wherever sep occurs, and returns the list of those strings.
bool TString::startsWith (TString & str) const
Returns true if this string starts with the string str; otherwise returns false. The comparison is case-sensitive.
ByteArray TString::toByteArray () const
Decodes a Base64 string into a ByteArray.
See also fromByteArray().
float TString::toFloat () const
Returns the string converted to a float value.
int TString::toInt () const
Returns the string converted to an int. Returns 0 if the conversion fails.
size_t TString::toLong () const
Returns the string converted to a long. Returns 0 if the conversion fails.
TString TString::toLower () const
Returns a lowercase copy of the string.
const std::string TString::toStdString () const
Returns a std::string object with the data contained in this TString.
std::wstring TString::toStdWString () const
Returns a std::wstring object with the data contained in this TString.
TString TString::toUpper () const
Returns an uppercase copy of the string.
std::u32string TString::toUtf32 () const
Returns a std::u32string object with the data contained in this TString.
TString TString::trimmed () const
Returns a string that has whitespace removed from the start and the end. This includes the ASCII characters ‘t’, ‘n’, ‘v’, ‘f’, ‘r’, and ‘ ‘.
bool TString::operator!= (TString & other) const
Returns true if this string is NOT equal to other; otherwise returns false.
The comparison is case-sensitive.
Returns a string that is the result of concatenating this string and other.
TString TString::operator+ (std::string & other) const
Returns a string that is the result of concatenating this string and other standard string.
TString TString::operator+ (char * other) const
Returns a string that is the result of concatenating this string and null terminated other charcter string.
TString TString::operator+ (char ch) const
Returns a string that is the result of concatenating this string and ch character.
Appends the string other onto the end of this string and returns a reference to this string.
TString & TString::operator+= (std::string & str)
Appends the standard string str to this string.
TString & TString::operator+= (char * str)
Appends the string str to this string. The const char pointer is converted to Unicode using the fromUtf8() function.
TString & TString::operator+= (char ch)
Appends the character ch to this string.
bool TString::operator< (TString & other) const
Returns true if this is lexically less than other; otherwise returns false.
bool TString::operator== (TString & other) const
Returns true if this string is equal to other; otherwise returns false.
The comparison is case-sensitive.
char TString::operator[] (int position)
Returns the character at the specified position in the string as a modifiable reference.