sincerely
Singaporean
If you have not done so, read this full tutorial on how to use SGEXTN to build an application.
class SGXString;
part of SGEXTN module SG_Core
Unicode compatible string with language aware features
list of all including inherited members
preprocessor file inclusion directive: #include ‹SGXString.h›
CMake target for BuildLah: SGEXTN::SG_Core
see this link for more information about BuildLah
parent class: (none)
children classes: (none)
SGXString(const char* cString);
SGXString();
SGXString(char c);
[[nodiscard]] SGXChar at(int i) const;
void cleanWhitespace() const;
[[nodiscard]] bool contains(SGXChar c) const;
[[nodiscard]] bool contains(const SGXString& s) const;
[[nodiscard]] int count(SGXChar c) const;
[[nodiscard]] int count(const SGXString& s) const;
[[nodiscard]] SGXString fillLeftToLength(int length, SGXChar fillChar) const;
[[nodiscard]] SGXString fillRightToLength(int length, SGXChar fillChar) const;
[[nodiscard]] int findFirstFromLeft(const SGXString& s) const;
[[nodiscard]] int findFirstFromLeft(SGXChar c) const;
[[nodiscard]] int findFirstFromLeftCustomStart(const SGXString& s, int start) const;
[[nodiscard]] int findFirstFromLeftCustomStart(SGXChar c, int start) const;
[[nodiscard]] int findFirstFromRight(SGXChar c) const;
[[nodiscard]] int findFirstFromRight(const SGXString& s) const;
[[nodiscard]] int findFirstFromRightCustomStart(const SGXString& s, int start) const;
[[nodiscard]] int findFirstFromRightCustomStart(SGXChar c, int start) const;
[[nodiscard]] SGXString getLowerLanguageAware() const;
[[nodiscard]] SGXString getUpperLanguageAware() const;
[[nodiscard]] int hash() const;
SGXString& insert(int pos, SGXChar c);
SGXString& insert(int pos, const SGXString& s);
[[nodiscard]] bool isASCII() const;
[[nodiscard]] bool isDigit() const;
[[nodiscard]] bool isDigitBase16() const;
[[nodiscard]] bool isEnglishAlphanumeric() const;
[[nodiscard]] bool isEnglishLetter() const;
[[nodiscard]] bool isEnglishLowercase() const;
[[nodiscard]] bool isEnglishUppercase() const;
[[nodiscard]] bool isWhitespace() const;
[[nodiscard]] int length() const;
[[nodiscard]] bool operator!=(const SGXString& x) const;
SGXString& operator+=(SGXChar x);
[[nodiscard]] SGXString operator+(const SGXString& x) const;
SGXString& operator+=(const SGXString& x);
[[nodiscard]] SGXString operator+(SGXChar x) const;
[[nodiscard]] bool operator‹(const SGXString& x) const;
[[nodiscard]] bool operator‹=(const SGXString& x) const;
[[nodiscard]] bool operator==(const SGXString& x) const;
[[nodiscard]] bool operator›(const SGXString& x) const;
[[nodiscard]] bool operator›=(const SGXString& x) const;
[[nodiscard]] double parseToDouble(bool* isValid) const;
[[nodiscard]] float parseToFloat(bool* isValid) const;
[[nodiscard]] int parseToInt(bool* isValid) const;
[[nodiscard]] int parseToIntBase16(bool* isValid) const;
[[nodiscard]] int parseToIntCustomBase(bool* isValid, int base) const;
[[nodiscard]] long long parseToLongLong(bool* isValid) const;
[[nodiscard]] long long parseToLongLongBase16(bool* isValid) const;
[[nodiscard]] long long parseToLongLongCustomBase(bool* isValid, int base) const;
[[nodiscard]] unsigned int parseToUnsignedInt(bool* isValid) const;
[[nodiscard]] unsigned int parseToUnsignedIntBase16(bool* isValid) const;
[[nodiscard]] unsigned int parseToUnsignedIntCustomBase(bool* isValid, int base) const;
[[nodiscard]] unsigned long long parseToUnsignedLongLong(bool* isValid) const;
[[nodiscard]] unsigned long long parseToUnsignedLongLongBase16(bool* isValid) const;
[[nodiscard]] unsigned long long parseToUnsignedLongLongCustomBase(bool* isValid, int base) const;
void removeLeadingTrailingWhitespace() const;
SGXString& replace(SGXChar oldChar, SGXChar newChar);
SGXString& replace(const SGXString& oldText, const SGXString& newText);
[[nodiscard]] SGLArray‹SGXString› split() const;
[[nodiscard]] SGLArray‹SGXString› splitCustomSeparator(SGXChar separator) const;
[[nodiscard]] SGLArray‹SGXString› splitCustomSeparator(const SGXString& separator) const;
[[nodiscard]] SGXString substring(int start, int length) const;
[[nodiscard]] SGXString substringLeft(int length) const;
[[nodiscard]] SGXString substringRight(int length) const;
void toLowerLanguageAware() const;
void toUpperLanguageAware() const;
static SGXString doubleToString(double x);
static SGXString doubleToStringDecimalPlaces(double x, int dp);
static SGXString doubleToStringScientificNotation(double x, int sf);
static SGXString doubleToStringSignificantFigures(double x, int sf);
static SGXString floatToString(float x);
static SGXString floatToStringDecimalPlaces(float x, int dp);
static SGXString floatToStringScientificNotation(float x, int sf);
static SGXString floatToStringSignificantFigures(float x, int sf);
static SGXString intToString(int x);
static SGXString intToStringBase16(int x);
static SGXString intToStringCustomBase(int x, int base);
static SGXString longLongToString(long long x);
static SGXString longLongToStringBase16(long long x);
static SGXString longLongToStringCustomBase(long long x, int base);
static SGXString repeatChar(SGXChar c, int count);
static SGXString unsignedIntToString(unsigned int x);
static SGXString unsignedIntToStringBase16(unsigned int x);
static SGXString unsignedIntToStringCustomBase(unsigned int x, int base);
static SGXString unsignedLongLongToString(unsigned long long x);
static SGXString unsignedLongLongToStringBase16(unsigned long long x);
static SGXString unsignedLongLongToStringCustomBase(unsigned long long x, int base);
SGXString is a string that can store anything in the Unicode Basic Multilingual Plane (essentially all characters you will ever need except for emojis) in a single SGXChar. It provides both string operations such as substring, string addition, and find-replace, in addition to language aware features including case conversion.
wrapper of QString, with usage of SGXChar
Creates a SGXString from C string cString.
Creates an empty SGXString, or a "".
Creates a SGXString containing a single character, c.
Creates a SGXString containing a single character, c.
Returns the SGXChar at index i of this SGXString.
If i is out of bounds, this will crash.
Removes leading and trailing whitespace from this SGXString and replaces all consecutive groups of whitespace characters with a single space.
Whitespace is defined by SGXChar::isWhitespace.
Returns if this SGXString contains the character c.
Returns if this SGXString contains the substring s.
Returns the number of characters c in this SGXString.
Returns the number of substrings s in this SGXString.
Returns the string formed when this SGXString is prefixed with fillChar until its length is at least length.
This SGXString is returned if its length is already more than or equal to length.
Returns the string formed when this SGXString is postfixed with fillChar until its length is at least length.
This SGXString is returned if its length is already more than or equal to length.
Returns the index of the first index of substring s found in this SGXString when searching from the left.
This returns -1 if the substring s is not in this SGXString.
Returns the index of the first index of character c found in this SGXString when searching from the left.
This returns -1 if the character c is not in this SGXString.
Returns the index of the first index of substring s found in this SGXString when searching from the left starting at start.
This returns -1 if the substring s is not in this SGXString.
This will crash if start is out of bounds.
Returns the index of the first index of character c found in this SGXString when searching from the left starting at start.
This returns -1 if the character c is not in this SGXString.
This will crash if start is out of bounds.
Returns the index of the first index of character c found in this SGXString when searching from the right.
This returns -1 if the character c is not in this SGXString.
Returns the index of the first index of substring s found in this SGXString when searching from the right.
This returns -1 if the substring s is not in this SGXString.
Returns the index of the first index of substring s found in this SGXString when searching from the right starting at start.
This returns -1 if the substring s is not in this SGXString.
This will crash if start is out of bounds.
Returns the index of the first index of character c found in this SGXString when searching from the right starting at start.
This returns -1 if the character c is not in this SGXString.
This will crash if start is out of bounds.
Returns the language aware lowercase version of this SGXString.
For a single SGXChar, use SGXChar::getLowerLanguageAware instead.
Returns the language aware uppercase version of this SGXString.
For a single SGXChar, use SGXChar::getUpperLanguageAware instead.
Hash function for SGLHash.
Inserts c into this SGXString such that c will start at index pos of this SGXString after insertion, then returns a reference to this SGXString to enable expression chaining.
Out of bounds pos will crash.
Inserts s into this SGXString such that s will start at index pos of this SGXString after insertion, then returns a reference to this SGXString to enable expression chaining.
Out of bounds pos will crash.
Returns if all characters in this SGXString are ASCII characters.
For a single SGXChar, use SGXChar::isASCII instead.
Returns if all characters in this SGXString are digits from 0 to 9.
For a single SGXChar, use SGXChar::isDigit instead.
Returns if all characters in this SGXString are base 16 digits from 0 to F.
Both uppercase and lowercase representations of non numerical base16 digits are accepted.
For a single SGXChar, use SGXChar::isDigitBase16 instead.
Returns if all characters in this SGXString are alphanumeric characters.
This can be used to validate usernames and file names.
For a single SGXChar, use SGXChar::isEnglishAlphanumeric instead.
Returns if all characters in this SGXString are English letters ignoring case.
For a single SGXChar, use SGXChar::isEnglishLetter instead.
Returns if all characters in this SGXString are English lowercase letters from a to z.
For a single SGXChar, use SGXChar::isEnglishLowercase instead.
Returns if all characters in this SGXString are English uppercase letters from A to Z.
For a single SGXChar, use SGXChar::isEnglishUppercase instead.
Returns if all characters in this SGXString are whitespace characters.
Whitespace is defined by SGXChar::isWhitespace.
For a single SGXChar, use SGXChar::isWhitespace instead.
Returns the length of this SGXString, which is the number of SGXChar it contains.
Returns if this SGXString is different from x.
Appends the SGXChar x behind this SGXString.
Appends the SGXString x behind this SGXString.
Appends the SGXString x behind this SGXString.
Appends the SGXChar x behind this SGXString.
Returns if this SGXString is in front of x when ordered alphabetically.
Returns if this SGXString is in front of or equal to x when ordered alphabetically.
Returns if this SGXString is the same as x.
Returns if this SGXString is behind x when ordered alphabetically.
Returns if this SGXString is behind or equal to x when ordered alphabetically.
Returns the double precision floating point number that this SGXString represents. If this SGXString does not represent a double precision floating point number, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a double precision floating point number and false otherwise.
If you are not interested in if this SGXString represents a double precision floating point number, pass nullptr to isValid.
Returns the floating point number that this SGXString represents. If this SGXString does not represent a floating point number, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a floating point number and false otherwise.
If you are not interested in if this SGXString represents a floating point number, pass nullptr to isValid.
Returns the int that this SGXString represents. If this SGXString does not represent a int, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a int and false otherwise.
If you are not interested in if this SGXString represents a int, pass nullptr to isValid.
Returns the int in base16 that this SGXString represents. If this SGXString does not represent a base16 int, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a base16 int and false otherwise.
If you are not interested in if this SGXString represents a base16 int, pass nullptr to isValid.
Both uppercase and lowercase represents of non numerical base16 digits are accepted.
Returns the int in base base that this SGXString represents. If this SGXString does not represent a base base int, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a base base int and false otherwise.
If you are not interested in if this SGXString represents a base base int, pass nullptr to isValid.
Both uppercase and lowercase represents of non numerical base base digits are accepted.
base being below 2 or above 36 is undefined behaviour.
Returns the long long that this SGXString represents. If this SGXString does not represent a long long, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a long long and false otherwise.
If you are not interested in if this SGXString represents a long long, pass nullptr to isValid.
Returns the long long in base16 that this SGXString represents. If this SGXString does not represent a base16 long long, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a base16 long long and false otherwise.
If you are not interested in if this SGXString represents a base16 long long, pass nullptr to isValid.
Both uppercase and lowercase represents of non numerical base16 digits are accepted.
Returns the long long in base base that this SGXString represents. If this SGXString does not represent a base base long long, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a base base long long and false otherwise.
If you are not interested in if this SGXString represents a base base long long, pass nullptr to isValid.
Both uppercase and lowercase represents of non numerical base base digits are accepted.
base being below 2 or above 36 is undefined behaviour.
Returns the unsigned int that this SGXString represents. If this SGXString does not represent a unsigned int, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a unsigned int and false otherwise.
If you are not interested in if this SGXString represents a unsigned int, pass nullptr to isValid.
Returns the unsigned int in base16 that this SGXString represents. If this SGXString does not represent a base16 unsigned int, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a base16 unsigned int and false otherwise.
If you are not interested in if this SGXString represents a base16 unsigned int, pass nullptr to isValid.
Both uppercase and lowercase represents of non numerical base16 digits are accepted.
Returns the unsigned int in base base that this SGXString represents. If this SGXString does not represent a base base unsigned int, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a base base unsigned int and false otherwise.
If you are not interested in if this SGXString represents a base base unsigned int, pass nullptr to isValid.
Both uppercase and lowercase represents of non numerical base base digits are accepted.
base being below 2 or above 36 is undefined behaviour.
Returns the unsigned long long that this SGXString represents. If this SGXString does not represent a unsigned long long, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a unsigned long long and false otherwise.
If you are not interested in if this SGXString represents a unsigned long long, pass nullptr to isValid.
Returns the unsigned long long in base16 that this SGXString represents. If this SGXString does not represent a base16 unsigned long long, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a base16 unsigned long long and false otherwise.
If you are not interested in if this SGXString represents a base16 unsigned long long, pass nullptr to isValid.
Both uppercase and lowercase represents of non numerical base16 digits are accepted.
Returns the unsigned long long in base base that this SGXString represents. If this SGXString does not represent a base base unsigned long long, 0 is returned as default. If isValid is not nullptr, the bool that it points to is set to true if this SGXString represents a base base unsigned long long and false otherwise.
If you are not interested in if this SGXString represents a base base unsigned long long, pass nullptr to isValid.
Both uppercase and lowercase represents of non numerical base base digits are accepted.
base being below 2 or above 36 is undefined behaviour.
Removes leading and trailing whitespace from this SGXString.
Whitespace is defined by SGXChar::isWhitespace.
Replaces every instance of oldChar in this SGXString with newChar, then returns a reference to this SGXString to enable expression chaining.
If this SGXString does not contain oldChar, nothing is done.
Replaces every instance of oldText in this SGXString with newText, then returns a reference to this SGXString to enable expression chaining.
If this SGXString does not contain oldText, nothing is done.
Returns a SGLArray of SGXString of space separated strings that make up this SGXString.
This can be used to parse text input.
The extracted strings will not contain any space.
Returns a SGLArray of SGXString of strings separated by character separator that make up this SGXString.
This can be used to parse text input.
The extracted strings will not contain any separator character.
Returns a SGLArray of SGXString of strings separated by substring separator that make up this SGXString.
This can be used to parse text input.
The extracted strings will not contain any separator substring.
Returns the substring of this SGXString starting at start with a length of length.
This will crash if start or start + length - 1 is out of bounds.
This will crash if length is negative.
Returns the substring of this SGXString containing the first length letters from the left.
This will crash is length is negative or greater than the length of this SGXString.
Returns the substring of this SGXString containing the first length letters from the right.
This will crash is length is negative or greater than the length of this SGXString.
Converts this SGXString to its language aware lowercase form.
For a single SGXChar, use SGXChar::toLowerLanguageAware instead.
Converts this SGXString to its language aware uppercase form.
For a single SGXChar, use SGXChar::toUpperLanguageAware instead.
Returns the SGXString that represents x.
Returns the SGXString that represents x rounded to dp decimal places. Negative dp rounds x to nearest 10 ^ ( - dp )
Returns the SGXString that represents x rounds to sf significant figures, expressed in scientific notation.
The exponent is prefixed with English lowercase letter e.
Negative or zero sf will crash.
Returns the SGXString that represents x rounds to sf significant figures.
Negative or zero sf will crash.
Returns the SGXString that represents x.
Returns the SGXString that represents x rounded to dp decimal places. Negative dp rounds x to nearest 10 ^ ( - dp )
Returns the SGXString that represents x rounds to sf significant figures, expressed in scientific notation.
The exponent is prefixed with English lowercase letter e.
Negative or zero sf will crash.
Returns the SGXString that represents x rounds to sf significant figures.
Negative or zero sf will crash.
Returns the SGXString that represents x.
Returns the SGXString that represents x in base16.
Returns the SGXString that represents x in base base.
Returns the SGXString that represents x.
Returns the SGXString that represents x in base16.
Returns the SGXString that represents x in base base.
Returns the SGXString formed by putting together count copies of c.
Negative count will crash.
Returns the SGXString that represents x.
Returns the SGXString that represents x in base16.
Returns the SGXString that represents x in base base.
Returns the SGXString that represents x.
Returns the SGXString that represents x in base16.
Returns the SGXString that represents x in base base.
©2025 05524F.sg (Singapore)