|
|
| String () |
| | Default constructor. Creates an empty Latin1 string.
|
| |
|
| String (std::nullptr_t) |
| | Constructs an empty string (null pointer overload).
|
| |
| | String (const char *str) |
| | Constructs from a null-terminated C string.
|
| |
| | String (const char *str, size_t len) |
| | Constructs from a character buffer with explicit length.
|
| |
| | String (size_t ct, char c) |
| | Constructs a string of repeated characters.
|
| |
| | String (const std::string &str) |
| | Constructs from a std::string (copy).
|
| |
| | String (std::string &&str) |
| | Constructs from a std::string (move).
|
| |
|
const std::string & | str () const |
| | Returns a const reference to the underlying std::string.
|
| |
|
const char * | cstr () const |
| | Returns a null-terminated C string pointer.
|
| |
|
size_t | size () const |
| | Returns the number of characters in the string.
|
| |
|
size_t | length () const |
| | Returns the number of characters in the string.
|
| |
|
size_t | byteCount () const |
| | Returns the number of bytes in the encoded representation.
|
| |
| uint8_t | byteAt (size_t idx) const |
| | Returns the byte at the given index.
|
| |
| Char | charAt (size_t idx) const |
| | Returns the character at the given index.
|
| |
|
bool | isEmpty () const |
| | Returns true if the string has zero length.
|
| |
|
int | referenceCount () const |
| | Returns the current shared reference count.
|
| |
|
bool | isLiteral () const |
| | Returns true if this string wraps an immutable literal.
|
| |
|
Encoding | encoding () const |
| | Returns the encoding of this string (Latin1 or Unicode).
|
| |
|
ConstIterator | begin () const noexcept |
| | Returns a const character iterator to the first character.
|
| |
| ConstIterator | cbegin () const noexcept |
| | Returns a const character iterator to the first character.
|
| |
|
ConstIterator | end () const noexcept |
| | Returns a const character iterator past the last character.
|
| |
| ConstIterator | cend () const noexcept |
| | Returns a const character iterator past the last character.
|
| |
|
| operator const std::string & () const |
| | Implicit conversion to const std::string reference.
|
| |
|
| operator const char * () const |
| | Implicit conversion to const char pointer.
|
| |
| size_t | find (char val, size_t from=0) const |
| | Finds the first occurrence of a character.
|
| |
| size_t | find (Char val, size_t from=0) const |
| | Finds the first occurrence of a character.
|
| |
| size_t | find (const char *val, size_t from=0) const |
| | Finds the first occurrence of a character.
|
| |
| size_t | find (const String &val, size_t from=0) const |
| | Finds the first occurrence of a character.
|
| |
| size_t | rfind (char val, size_t from=npos) const |
| | Finds the last occurrence of a character.
|
| |
| size_t | rfind (Char val, size_t from=npos) const |
| | Finds the last occurrence of a character.
|
| |
| size_t | rfind (const char *val, size_t from=npos) const |
| | Finds the last occurrence of a character.
|
| |
| size_t | rfind (const String &val, size_t from=npos) const |
| | Finds the last occurrence of a character.
|
| |
| bool | contains (char val) const |
| | Returns true if the string contains the given value.
|
| |
| bool | contains (Char val) const |
| | Returns true if the string contains the given value.
|
| |
| bool | contains (const String &val) const |
| | Returns true if the string contains the given value.
|
| |
| bool | contains (const char *val) const |
| | Returns true if the string contains the given value.
|
| |
| size_t | count (const String &substr) const |
| | Counts non-overlapping occurrences of a substring.
|
| |
| String | substr (size_t pos=0, size_t len=npos) const |
| | Returns a substring.
|
| |
| String | mid (size_t pos, size_t count=npos) const |
| | Returns a substring starting at pos (alias for substr).
|
| |
| String | left (size_t count) const |
| | Returns the first count characters.
|
| |
| String | right (std::size_t count) const |
| | Returns the last count characters.
|
| |
|
void | clear () |
| | Removes all characters from the string.
|
| |
| void | resize (size_t val) |
| | Resizes the string to the given character count.
|
| |
| void | erase (size_t pos, size_t count=1) |
| | Erases characters from the string.
|
| |
| void | setCharAt (size_t idx, Char ch) |
| | Sets the character at the given index (promotes to Unicode if needed).
|
| |
| void | insert (size_t pos, const String &s) |
| | Inserts a string at the given position (promotes to Unicode if needed).
|
| |
|
String & | operator= (const std::string &str) |
| | Assigns from a std::string (copy).
|
| |
|
String & | operator= (std::string &&str) |
| | Assigns from a std::string (move).
|
| |
|
String & | operator= (const char *str) |
| | Assigns from a C string.
|
| |
| String & | operator+= (const String &val) |
| | Appends a String to this string (promotes to Unicode if needed).
|
| |
| String & | operator+= (const std::string &val) |
| | Appends a String to this string (promotes to Unicode if needed).
|
| |
| String & | operator+= (const char *val) |
| | Appends a String to this string (promotes to Unicode if needed).
|
| |
| String & | operator+= (char val) |
| | Appends a String to this string (promotes to Unicode if needed).
|
| |
| String | operator+ (const String &val) const |
| | Returns the concatenation of this string and val.
|
| |
| String | operator+ (const std::string &val) const |
| | Returns the concatenation of this string and val.
|
| |
| String | operator+ (const char *val) const |
| | Returns the concatenation of this string and val.
|
| |
| String | operator+ (char val) const |
| | Returns the concatenation of this string and val.
|
| |
| bool | operator== (const String &val) const |
| | Equality comparison with another String.
|
| |
| bool | operator== (const char *val) const |
| | Equality comparison with another String.
|
| |
| bool | operator== (char val) const |
| | Equality comparison with another String.
|
| |
|
bool | operator!= (const String &val) const |
| | Inequality comparison.
|
| |
| bool | operator!= (const char *val) const |
| | Inequality comparison.
|
| |
| bool | operator!= (char val) const |
| | Inequality comparison.
|
| |
|
String | toUpper () const |
| | Returns an uppercase copy of this string.
|
| |
|
String | toLower () const |
| | Returns a lowercase copy of this string.
|
| |
|
String | trim () const |
| | Returns a copy with leading and trailing whitespace removed.
|
| |
| bool | startsWith (const String &prefix) const |
| | Returns true if the string starts with the given prefix.
|
| |
| bool | startsWith (char c) const |
| | Returns true if the string starts with the given character.
|
| |
| bool | endsWith (const String &suffix) const |
| | Returns true if the string ends with the given suffix.
|
| |
|
String | reverse () const |
| | Returns a copy with characters in reverse order.
|
| |
|
bool | isNumeric () const |
| | Returns true if every character is a decimal digit.
|
| |
|
String | replace (const String &find, const String &replacement) const |
| | Returns a copy with all occurrences of find replaced by replacement.
|
| |
| int | compareIgnoreCase (const String &other) const |
| | Case-insensitive comparison.
|
| |
| uint64_t | hash () const |
| | Returns a 64-bit FNV-1a hash of this string's native data.
|
| |
| String | toLatin1 () const |
| | Returns a Latin1 version of this string.
|
| |
| String | toUnicode () const |
| | Returns a Unicode version of this string.
|
| |
| String & | arg (const String &str) |
| | Replaces the lowest-numbered N placeholder with the given string.
|
| |
|
String & | arg (int8_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Replaces the lowest {N} token with the formatted numeric value.
|
| |
|
String & | arg (uint8_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Replaces the lowest {N} token with the formatted numeric value.
|
| |
|
String & | arg (int16_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Replaces the lowest {N} token with the formatted numeric value.
|
| |
|
String & | arg (uint16_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Replaces the lowest {N} token with the formatted numeric value.
|
| |
|
String & | arg (int32_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Replaces the lowest {N} token with the formatted numeric value.
|
| |
|
String & | arg (uint32_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Replaces the lowest {N} token with the formatted numeric value.
|
| |
|
String & | arg (int64_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Replaces the lowest {N} token with the formatted numeric value.
|
| |
|
String & | arg (uint64_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Replaces the lowest {N} token with the formatted numeric value.
|
| |
| template<typename OutputType > |
| OutputType | to (Error *err=nullptr) const |
| | Converts the string to a value of type OutputType.
|
| |
| bool | toBool (Error *err=nullptr) const |
| | Converts the string to a boolean.
|
| |
| int | toInt (Error *err=nullptr) const |
| | Converts the string to an integer.
|
| |
| unsigned int | toUInt (Error *err=nullptr) const |
| | Converts the string to an unsigned integer.
|
| |
| double | toDouble (Error *err=nullptr) const |
| | Converts the string to a double.
|
| |
| int64_t | parseNumberWords (Error *err=nullptr) const |
| | Parses English number words into an integer value.
|
| |
| StringList | split (const std::string &delimiter) const |
| | Splits the string by a delimiter.
|
| |
|
| static String | number (int8_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Converts a numeric value to its String representation.
|
| |
| static String | number (uint8_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Converts a numeric value to its String representation.
|
| |
| static String | number (int16_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Converts a numeric value to its String representation.
|
| |
| static String | number (uint16_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Converts a numeric value to its String representation.
|
| |
| static String | number (int32_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Converts a numeric value to its String representation.
|
| |
| static String | number (uint32_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Converts a numeric value to its String representation.
|
| |
| static String | number (int64_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Converts a numeric value to its String representation.
|
| |
| static String | number (uint64_t value, int base=10, int padding=0, char padchar=' ', bool addPrefix=false) |
| | Converts a numeric value to its String representation.
|
| |
| static String | number (bool value) |
| | Returns "true" or "false" for a boolean value.
|
| |
| static String | number (float value, int precision=9) |
| | Converts a float to its string representation.
|
| |
| static String | number (double value, int precision=9) |
| | Converts a float to its string representation.
|
| |
| template<typename T > |
| static String | dec (const T &val, int padding=0, char padchar=' ') |
| | Formats a value as a decimal string with optional padding.
|
| |
| template<typename T > |
| static String | hex (const T &val, int padding=0, bool addPrefix=true) |
| | Formats a value as a hexadecimal string.
|
| |
| template<typename T > |
| static String | bin (const T &val, int digits=32, bool addPrefix=true) |
| | Formats a value as a binary string.
|
| |
| static String | sprintf (const char *fmt,...) |
| | Creates a formatted string using printf-style syntax.
|
| |
| static String | fromUtf8 (const char *data, size_t len) |
| | Creates a String by decoding UTF-8 data.
|
| |
| static String | fromLiteralData (StringData *data) |
| | Wraps a static literal StringData without copying.
|
| |
Encoding-aware string class with copy-on-write semantics.
String is a lightweight handle wrapping a SharedPtr<StringData>. Copy is a refcount increment; mutation triggers COW. Latin1 is the fast path (byte == character). Unicode strings store decoded codepoints for O(1) indexed access.