|
CoreComponents 3.0.0
A Modern C++ Toolkit
|
String of characters More...
#include <cc/String>
Public Types | |
| using | Item = char |
| Item type. | |
Public Types inherited from Array< uint8_t > | |
| using | Item |
| Item type. | |
| using | value_type |
| Item value type. | |
| using | size_type |
| Type of the container capacity. | |
| using | iterator |
| Value iterator. | |
| using | const_iterator |
| Readonly value iterator. | |
| using | reverse_iterator |
| Reverse value iterator. | |
| using | const_reverse_iterator |
| Readonly reverse value iterator. | |
Standard Iterators | |
| using | value_type = Item |
| Item value type. | |
| using | size_type = long |
| Type of the container capacity. | |
| using | iterator = ArrayIterator<String, 1> |
| Value iterator. | |
| using | const_iterator = ArrayIterator<const String, 1> |
| Readonly value iterator. | |
| using | reverse_iterator = ArrayIterator<String, -1> |
| Reverse value iterator. | |
| using | const_reverse_iterator = ArrayIterator<const String, -1> |
| Readonly reverse value iterator. | |
| iterator | begin () |
| Return iterator pointing to the first item (if any) | |
| iterator | end () |
| Return iterator pointing behind the last item | |
| const_iterator | begin () const |
| Return readonly iterator pointing to the first item (if any) | |
| const_iterator | cbegin () const |
| Return readonly iterator pointing to the first item (if any) | |
| const_iterator | end () const |
| Return readonly iterator pointing behind the last item | |
| const_iterator | cend () const |
| Return readonly iterator pointing behind the last item | |
| reverse_iterator | rbegin () |
| Return reverse iterator pointing to the last item (if any) | |
| reverse_iterator | rend () |
| Return reverse iterator pointing before the first item | |
| const_reverse_iterator | rbegin () const |
| Return readonly reverse iterator pointing to the last item (if any) | |
| const_reverse_iterator | crbegin () const |
| Return readonly reverse iterator pointing to the last item (if any) | |
| const_reverse_iterator | rend () const |
| Return reverse iterator pointing before the first item | |
| const_reverse_iterator | crend () const |
| Return reverse iterator pointing before the first item | |
Construction and Assignment | |
| String ()=default | |
| Create an empty string. | |
| String (const char *b) | |
| Construct a copy of string literal b. | |
| String (const char *b, long n) | |
| Construct a copy of of the first n characters of b. | |
| String (const Bytes &b, long i0, long i1) | |
| Construct a deep copy of the sub-string [i0, i1) of b. | |
| template<class Part > | |
| String (const List< Part > &parts) | |
| Join a list of strings. | |
| template<class Part > | |
| String (const List< Part > &parts, const String &sep) | |
| Join a list of strings using sep as interposing separator. | |
| template<class Part > | |
| String (const List< Part > &parts, char sep) | |
| Join a list of strings using sep as interposing separator. | |
| template<class Part > | |
| String (const List< Part > &parts, const char *sep) | |
| Join a list of strings using sep as interposing separator. | |
| template<class Part > | |
| String (const List< Part > &parts, const char *sep, long sepCount) | |
| Join a list of strings using sep as interposing separator. | |
| static String | allocate (long n, char b) |
| Create a string of n characters initialized with b. | |
| static String | allocate (long n) |
| Create an uninitialized string of n characters. | |
Item Access | |
| long | count () const |
| Get the length of the string in number of characters. | |
| operator bool () const | |
| Check if this string is non-empty. | |
| long | operator+ () const |
| Get the length of the string in number of characters. | |
| bool | has (long i) const |
| Check if i is a valid index. | |
| char & | at (long i) |
| Get a reference to the character at i. | |
| const char & | at (long i) const |
| Get a constant reference to the character at i. | |
| char & | operator[] (long i) |
| Get a reference to the character at i. | |
| const char & | operator[] (long i) const |
| Get a constant reference to the character at i. | |
| char & | operator[] (int i) |
| Help the C++ compiler to not fall back to operator char*() for index access. | |
| const char & | operator[] (int i) const |
| Help the C++ compiler to not fall back to operator char*() for index access. | |
| char | operator() (long i, char fallback='\0') const |
| Get value at i if 0 <= i && i < count(), otherwise return fallback. | |
| bool | startsWith (char b) const |
| Check if the first character of this string equals b. | |
| bool | startsWith (const char *b, long bn=-1) const |
| Check if this string starts with sub-string b. | |
| bool | startsWith (const String &b) const |
| Check if this string starts with sub-string b. | |
| bool | endsWith (char b) const |
| Check if the last character of this string equals b. | |
| bool | endsWith (const char *b, long bn=-1) const |
| Check if this tring ends with sub-string b. | |
| bool | endsWith (const String &b) const |
| Check if this tring ends with sub-string b. | |
Global Operations | |
| String | copy () const |
| Create a deep copy of this string. | |
| String | copy (long i0, long i1) const |
| Create a deep copy of range [i0, i1) | |
| String | copy (Range range) const |
| Create a deep copy of range. | |
| void | resize (long n) |
| Resize this string to n characters preserving the contents (new characters preset with '\0') | |
| void | truncate (long n) |
| Reduce the length of this string to n characters without freeing memory. | |
| String | select (long i0, long i1) |
| Return a selection of range [i0, i1) | |
| String | select (Range range) |
| Return a selection of range | |
| String | selectHead (long n) |
| Select the first n characters or less (if n > count()) | |
| String | selectTail (long n) |
| Select the last n characters or less (if n > count()) | |
| String & | selectAs (long i0, long i1, Out< String > target) |
| Return a selection of range [i0, i1) in target | |
| String & | selectAs (Range range, Out< String > target) |
| Return a selection of range in target | |
| String | alignedLeft (int w, char blank=' ') const |
| Align text to the left. | |
| String | alignedRight (int w, char blank=' ') const |
| Align text to the right. | |
| String | parent () |
| Get parent string if this string is a sub-string selection. | |
| long | count (char b) const |
| Count the number of occurences of character b. | |
| bool | find (char b, InOut< long > i0=None{}) const |
| Find character b. | |
| bool | find (const char *b, long bn=-1, InOut< long > i0=None{}) const |
| Find sub-string b in this string. | |
| bool | find (const String &b, InOut< long > i0=None{}) const |
| Find sub-string b in this string. | |
| bool | contains (char b) const |
| Check if this string contains character b | |
| bool | contains (const char *b) const |
| Check if this string contains sub-string b | |
| bool | contains (const String &b) const |
| Check if this string contains sub-string b | |
| void | replace (char a, char b) |
| Replace all occurance of a in this string by b. | |
| void | replace (const char *b, const char *s) |
| Replace all occurance of b in this string by s. | |
| void | replace (const char *b, const String &s) |
| Replace all occurance of b in this string by s. | |
| void | replace (const String &b, const char *s) |
| Replace all occurance of b in this string by s. | |
| void | replace (const String &b, const String &s) |
| Replace all occurance of b in this string by s. | |
| String | replaced (const char *b, const char *s) const |
| Obtain a copy of this string where all occurances of b are replaced by s. | |
| String | replaced (const char *b, const String &s) const |
| Obtain a copy of this string where all occurances of b are replaced by s. | |
| String | replaced (const String &b, const char *s) const |
| Obtain a copy of this string where all occurances of b are replaced by s. | |
| String | replaced (const String &b, const String &s) const |
| Obtain a copy of this string where all occurances of b are replaced by s. | |
| List< String > | split (char sep) const |
| Create a string list by splitting this string into pieces. | |
| List< String > | split (const char *sep) const |
| Create a string list by splitting this string into pieces. | |
| List< String > | split (const String &sep) const |
| Create a string list by splitting this string into pieces. | |
| List< String > | breakUp (long m) const |
| Breakup this string into equal sized pieces of m characters. | |
| String & | operator+= (char b) |
| Append b to this string. | |
| String & | operator+= (const char *b) |
| Append b to this string. | |
| String & | operator+= (const String &b) |
| Append b to this string. | |
| String | times (long n) const |
| Return a string which comprises of n times this string concatenated together | |
| String | operator* (long n) const |
| Return a string which comprises of n times this string concatenated together | |
| String | paste (long i0, long i1, const String &text) const |
| Create an edited version of this string by replacing a sub-string. | |
| void | downcase () |
| Convert all upper-case characters in this string to the corresponding lower-case characters. | |
| void | upcase () |
| Convert all lower-case characters in this string to the corresponding uppser-case characters. | |
| String | downcased () const |
| Return a copy of this string with all upper-case characters converted to the corresponding lower-case characters | |
| String | upcased () const |
| Return a copy of this string with all lower-case characters converted to the corresponding upper-case characters | |
| void | trim (const char *ls=" \t\n\r", const char *ts=nullptr) |
| Remove leading and trailing whitespace. | |
| void | trim (const String &ls, const String &ts) |
| Remove leading and trailing whitespace. | |
| void | trimBom () |
| Remove a UTF-8 encoded Byte Order Mark (BOM) if present. | |
| String | trimmed (const char *ls=" \t\n\r", const char *ts=nullptr) const |
| Obtain a copy of this string with leading and trailing whitespace removed. | |
| String | trimmed (const String &ls, const String &ts) const |
| Obtain a copy of this string with leading and trailing whitespace removed. | |
| void | trimLeading (const char *ws=" \t\n\r") |
| Remove leading whitespace. | |
| void | trimLeading (const String &ws) |
| Remove leading whitespace. | |
| String | leadingTrimmed (const char *ws=" \t\n\r") const |
| Obtain a copy of this string with leading whitespace removed. | |
| String | leadingTrimmed (const String &ws) const |
| Obtain a copy of this string with leading whitespace removed. | |
| void | trimTrailing (const char *ws=" \t\n\r") |
| Remove trailing whitespace. | |
| void | trimTrailing (const String &ws) |
| Remove trailing whitespace. | |
| String | trailingTrimmed (const char *ws=" \t\n\r") const |
| Obtain a copy of this string with trailing whitespace removed. | |
| String | trailingTrimmed (const String &ws) const |
| Obtain a copy of this string with trailing whitespace removed. | |
| void | simplify (const char *ws=" \t\n\r") |
| Replace multi-character whitespace sequences within this string by single space characters. | |
| void | simplify (const String &ws) |
| Replace multi-character whitespace sequences within this string by single space characters. | |
| String | simplified (const char *ws=" \t\n\r") const |
| Replace multi-character whitespace sequences within this string by single space characters. | |
| String | simplified (const String &ws) const |
| Replace multi-character whitespace sequences within this string by single space characters. | |
| void | escape () |
| Replace all non-printable and non-ASCII characters by escape sequences. | |
| String | escaped () const |
| Replace all non-printable and non-ASCII characters by escape sequences. | |
| void | expand () |
| Replace escape sequences by their character value or multi-byte representation. | |
| String | expanded () |
| Replace escape sequences by their character value or multi-byte representation. | |
| String | indented (const String &prefix) |
| Insert prefix at the beginning of each line of text. | |
| bool | toBool (Out< bool > ok=None{}) const |
| Read this string as a boolean value. | |
| int | toInt (Out< bool > ok=None{}) const |
| Read this string as an integer number. | |
| long | toLong (Out< bool > ok=None{}) const |
| Read this string as an long integer number. | |
| double | toDouble (Out< bool > ok=None{}) const |
| Read this string as an floating point number. | |
| template<class T > | |
| bool | read (Out< T > value) const |
| Read this string as a value ot type T. | |
| template<class T , int base = -1> | |
| bool | readNumber (Out< T > value) const |
| Read this string as a number of type T. | |
| template<class T , int base = -1> | |
| bool | readNumberInRange (long i0, long i1, Out< T > value) const |
| Read the sub-string in range [i0, i1) as a number of type T. | |
File Paths | |
| bool | isRootPath () const |
| Check if this path points to the root directory. | |
| bool | isAbsolutePath () const |
| Check if this path is an absolute path. | |
| bool | isRelativePath () const |
| Check if this path is a relative path. | |
| bool | isHerePath () const |
| Check if this is a here path (e.g. | |
| String | absolutePathRelativeTo (const String ¤tDir) const |
| Convert to an absolute path. | |
| String | fileName () const |
| Return the file name component of this path | |
| String | baseName () const |
| Return the file name of this path without the file type suffix | |
| String | fileSuffix () const |
| Return the file type suffix of this path | |
| String | longBaseName () const |
| Return the file name of this path up to the last '. | |
| String | shortFileSuffix () const |
| Return the short file type suffix of this path | |
| String | sansFileSuffix () const |
| Return the same file path without the file name's suffix | |
| String | operator/ (const String &relativePath) const |
| Extend this path by relativePath. | |
| String | cd (const String &target) const |
| Navigate from this path to target path. | |
| String | cdUp () const |
| Convenience method, equivalent to cd("..") | |
| String | canonicalPath () const |
| Remove redundant and ambigous components from this path. | |
Comparism operators | |
| bool | operator== (const String &other) const |
| Equality operator. | |
| std::strong_ordering | operator<=> (const String &other) const |
| Ordering operator. | |
| std::strong_ordering | operator<=> (const char *other) const |
| Ordering operator. | |
Type Compatibility | |
| bool | isCString () const |
| Check if this string is zero-terminated. | |
| String | cString () const |
| Return a zero-terminated version of this string | |
| const Bytes & | asBytes () const |
| Return this string as byte array | |
| operator char * () | |
| Automatic conversion to low-level C-string. | |
| operator const char * () const | |
| Automatic conversion to low-level C-string. | |
| operator void * () | |
| Automatic conversion to low-level data pointer. | |
| operator const void * () const | |
| Automatic conversion to constant low-level data pointer. | |
Additional Inherited Members | |
Public Member Functions inherited from Array< uint8_t > | |
| iterator | begin () |
| Return iterator pointing to the first item (if any) | |
| const_iterator | begin () const |
| Return readonly iterator pointing to the first item (if any) | |
| iterator | end () |
| Return iterator pointing behind the last item | |
| const_iterator | end () const |
| Return readonly iterator pointing behind the last item | |
| const_iterator | cbegin () const |
| Return readonly iterator pointing to the first item (if any) | |
| const_iterator | cend () const |
| Return readonly iterator pointing behind the last item | |
| reverse_iterator | rbegin () |
| Return reverse iterator pointing to the last item (if any) | |
| const_reverse_iterator | rbegin () const |
| Return readonly reverse iterator pointing to the last item (if any) | |
| reverse_iterator | rend () |
| Return reverse iterator pointing before the first item | |
| const_reverse_iterator | rend () const |
| Return reverse iterator pointing before the first item | |
| const_reverse_iterator | crbegin () const |
| Return readonly reverse iterator pointing to the last item (if any) | |
| const_reverse_iterator | crend () const |
| Return reverse iterator pointing before the first item | |
| Array () | |
| Create an empty array. | |
| Array (Dim< 1 > dim) | |
| Create a array of dim[0] items. | |
| Array (const Array &other)=default | |
| Construct a copy of other. | |
| Array (Array &&b) | |
| Construct from right-side b. | |
| Array (std::initializer_list< uint8_t > items) | |
| Construct with initial items. | |
| Array (std::initializer_list< Array > arrays) | |
| Concatenate arrays into a single new array. | |
| Array (const Item *src, long count) | |
| Create a copy of the low-level array src of count items. | |
| Array (const List< Array > &parts) | |
| Join several arrays into one. | |
| Array (const List< Array > &parts, Item sep) | |
| Join several arrays into one using sep as interposing separator. | |
| Array & | operator= (const Array &)=default |
| Default assignment operator. | |
| Array & | operator= (Array &&b) |
| Assign right-side b. | |
| const Item * | items () const |
| Get pointer to internal memory buffer. | |
| Item * | items () |
| Get pointer to internal memory buffer. | |
| const char * | chars () const |
| Low-level access to the underlying characters. | |
| char * | chars () |
| Low-level access to the underlying characters. | |
| const uint8_t * | bytes () const |
| Low-level access to the underlying bytes. | |
| uint8_t * | bytes () |
| Low-level access to the underlying bytes. | |
| const uint32_t * | words () const |
| Low-level access to the underlying memory words. | |
| uint32_t * | words () |
| Low-level access to the underlying memory words. | |
| operator OtherItem * () | |
| Explicit conversion to low-level pointer. | |
| operator const OtherItem * () const | |
| Explicit conversion to constant low-level pointer. | |
| operator void * () | |
| Implicit conversion to low-level data pointer. | |
| operator const void * () const | |
| Implicit conversion to constant low-level data pointer. | |
| void | wrapAround (void *data, long count) |
| Wrap this array around the low-level memory vector data of count items. | |
| long | count () const |
| Size of this array in number of items. | |
| long | size () const |
| Size of this array in number of items. | |
| bool | has (long i) const |
| Check if i is a valid index. | |
| operator bool () const | |
| Check if this array is non-empty. | |
| long | operator+ () const |
| Size of this array in number of items. | |
| Item & | at (long i) |
| Get a reference to the item at i. | |
| const Item & | at (long i) const |
| Get a constant reference to the item at i. | |
| long | itemCount () const |
| Get number of items of type U. | |
| U & | item (long j) |
| Return a reference to an object of type U at object index j | |
| const U & | item (long j) const |
| Return a constant reference to an object of type U at object index j | |
| std::uint8_t & | byteAt (long j) |
| Convenience function for item<std::uint8_t>() | |
| const std::uint8_t & | byteAt (long j) const |
| Convenience function for item<std::uint8_t>() | |
| std::uint32_t & | wordAt (long j) |
| Convenience function for item<std::uint32_t>() | |
| const std::uint32_t & | wordAt (long j) const |
| Convenience function for item<std::uint32_t>() | |
| Item & | operator[] (long i) |
| Get a reference to the item at i. | |
| const Item & | operator[] (long i) const |
| Get a constant reference to the item at i. | |
| Item | operator() (long i) const |
| Get value at index if 0 <= i && i < count(), otherwise return fallback. | |
| Array & | operator() (long i, const uint8_t &value) |
| Set value at index if 0 <= i && i < count(), otherwise do nothing. | |
| const Item & | first () const |
| Get constant reference to first item. | |
| const Item & | last () const |
| Get constant reference to last item. | |
| bool | startsWith (const Array &head) const |
| Check if head equals the start of this array. | |
| bool | endsWith (const Array &tail) const |
| Check if tail equals the end of this array. | |
| long | count (const Item &b) const |
| Count the number of occurences of item b. | |
| bool | find (const Item &b, InOut< long > i0=None{}) const |
| Find item b. | |
| void | replace (const Item &b, const Item &s) |
| Replace all occurance of b by s. | |
| Array | copy () const |
| Create a deep copy of this array. | |
| Array | copy (long i0, long i1) const |
| Create a copy of range [i0, i1) | |
| void | copyRangeTo (long i0, long i1, Out< Array > dst) const |
| Copy the items in range [i0, i1] to array dst. | |
| void | copyRangeToOffset (long i0, long i1, Out< Array > dst, long j0) const |
| Copy the items in range [i0, i1] to array dst starting at item dst[j0]. | |
| void | copyTo (Out< Array > dst) const |
| Copy contents of this array to array dst. | |
| void | copyToOffset (Out< Array > dst, long j0) const |
| Copy contents of this array to array dst starting at item dst[j0]. | |
| void | copyToRange (Out< Array > dst, long j0, long j1) const |
| Copy contents of this array to array dst in the range dst[j0]..dst[j1-1]. | |
| void | applyTo (InOut< Array > dst) const |
| Apply the contents of this array to array dst. | |
| void | fill (const Item &b) |
| Set all items to b | |
| void | resize (long n) |
| Resize this array to n items preserving the contents (new items are uninitialized) | |
| void | truncate (long n) |
| Reduce the length of this array to n items without freeing memory. | |
| void | deplete () |
| Truncate to zero length and free all previously stored items. | |
| Array | select (long i0, long i1) |
| Return a selection of range [i0, i1) | |
| Array & | selectAs (long i0, long i1, Out< Array > target) |
| Return a selection of range [i0, i1) in target | |
| Array | selectHead (long n) |
| Select the first n items or less (if n > count()) | |
| Array | selectTail (long n) |
| Select the last n items or less (if n > count()) | |
| long | offset () const |
| Offset of this array within its parent array if this array is a selection (0 otherwise) | |
| Array | parent () |
| Get parent array if this array is a selection. | |
| void | shift (long n) |
| Truncate |n| items from the front (n > 0) or from the back (n < 0) | |
| void | reverse () |
| Reverse the order of items in this array. | |
| Array | reversed () const |
| Get a copy of this array with order of items reversed. | |
| bool | operator== (const Array &other) const |
| Equality operator. | |
| std::strong_ordering | operator<=> (const Array &other) const |
| Ordering operator. | |
Static Public Member Functions inherited from Array< uint8_t > | |
| static Array | allocate (long n) |
| Create a array of n items. | |
| static Array | wrap (void *data, long count) |
| Create a new array wrapped around data containing count items. | |
String of characters
| using Item = char |
Item type.
| using value_type = Item |
Item value type.
| using size_type = long |
Type of the container capacity.
| using iterator = ArrayIterator<String, 1> |
Value iterator.
| using const_iterator = ArrayIterator<const String, 1> |
Readonly value iterator.
| using reverse_iterator = ArrayIterator<String, -1> |
Reverse value iterator.
| using const_reverse_iterator = ArrayIterator<const String, -1> |
Readonly reverse value iterator.
|
default |
Create an empty string.
| String | ( | const char * | b | ) |
Construct a copy of string literal b.
| String | ( | const char * | b, |
| long | n ) |
Construct a copy of of the first n characters of b.
Join a list of strings using sep as interposing separator.
| Part | Type of the parts to join together: either String or Bytes |
Join a list of strings using sep as interposing separator.
| Part | Type of the parts to join together: either String or Bytes |
Join a list of strings using sep as interposing separator.
|
explicit |
Join a list of strings using sep as interposing separator.
| Part | Type of the parts to join together: either String or Bytes |
|
static |
Create a string of n characters initialized with b.
|
static |
Create an uninitialized string of n characters.
| long count | ( | ) | const |
Get the length of the string in number of characters.
|
explicit |
Check if this string is non-empty.
| long operator+ | ( | ) | const |
Get the length of the string in number of characters.
| bool has | ( | long | i | ) | const |
Check if i is a valid index.
| char & at | ( | long | i | ) |
Get a reference to the character at i.
| const char & at | ( | long | i | ) | const |
Get a constant reference to the character at i.
| char & operator[] | ( | long | i | ) |
Get a reference to the character at i.
| const char & operator[] | ( | long | i | ) | const |
Get a constant reference to the character at i.
| char & operator[] | ( | int | i | ) |
Help the C++ compiler to not fall back to operator char*() for index access.
| const char & operator[] | ( | int | i | ) | const |
Help the C++ compiler to not fall back to operator char*() for index access.
| char operator() | ( | long | i, |
| char | fallback = '\0' ) const |
Get value at i if 0 <= i && i < count(), otherwise return fallback.
| bool startsWith | ( | char | b | ) | const |
Check if the first character of this string equals b.
| bool startsWith | ( | const char * | b, |
| long | bn = -1 ) const |
Check if this string starts with sub-string b.
| bool startsWith | ( | const String & | b | ) | const |
Check if this string starts with sub-string b.
| bool endsWith | ( | char | b | ) | const |
Check if the last character of this string equals b.
| bool endsWith | ( | const char * | b, |
| long | bn = -1 ) const |
Check if this tring ends with sub-string b.
| bool endsWith | ( | const String & | b | ) | const |
Check if this tring ends with sub-string b.
| String copy | ( | ) | const |
Create a deep copy of this string.
| String copy | ( | long | i0, |
| long | i1 ) const |
Create a deep copy of range [i0, i1)
| void resize | ( | long | n | ) |
Resize this string to n characters preserving the contents (new characters preset with '\0')
| void truncate | ( | long | n | ) |
Reduce the length of this string to n characters without freeing memory.
| String select | ( | long | i0, |
| long | i1 ) |
Return a selection of range [i0, i1)
Return a selection of range [i0, i1) in target
Return a selection of range in target
| String alignedLeft | ( | int | w, |
| char | blank = ' ' ) const |
Align text to the left.
| w | Width of display field |
| blank | Fill character |
| String alignedRight | ( | int | w, |
| char | blank = ' ' ) const |
Align text to the right.
| w | Width of display field |
| blank | Fill character |
| String parent | ( | ) |
Get parent string if this string is a sub-string selection.
| long count | ( | char | b | ) | const |
Count the number of occurences of character b.
Find character b.
| b | The character to search for |
| i0 | Provides the starting position and returns the final position |
Find sub-string b in this string.
| bool contains | ( | char | b | ) | const |
Check if this string contains character b
| bool contains | ( | const char * | b | ) | const |
Check if this string contains sub-string b
| bool contains | ( | const String & | b | ) | const |
Check if this string contains sub-string b
| void replace | ( | char | a, |
| char | b ) |
Replace all occurance of a in this string by b.
| void replace | ( | const char * | b, |
| const char * | s ) |
Replace all occurance of b in this string by s.
| void replace | ( | const char * | b, |
| const String & | s ) |
Replace all occurance of b in this string by s.
| void replace | ( | const String & | b, |
| const char * | s ) |
Replace all occurance of b in this string by s.
| String replaced | ( | const char * | b, |
| const char * | s ) const |
Obtain a copy of this string where all occurances of b are replaced by s.
Obtain a copy of this string where all occurances of b are replaced by s.
Obtain a copy of this string where all occurances of b are replaced by s.
Obtain a copy of this string where all occurances of b are replaced by s.
Create a string list by splitting this string into pieces.
| sep | split marker(s) to search for |
Create a string list by splitting this string into pieces.
| sep | split marker(s) to search for |
Create a string list by splitting this string into pieces.
| sep | split marker(s) to search for |
| String & operator+= | ( | char | b | ) |
Append b to this string.
| String & operator+= | ( | const char * | b | ) |
Append b to this string.
| String times | ( | long | n | ) | const |
Return a string which comprises of n times this string concatenated together
| String operator* | ( | long | n | ) | const |
Return a string which comprises of n times this string concatenated together
Create an edited version of this string by replacing a sub-string.
| i0 | begin of sub-string (index of first selected character) |
| i1 | end of sub-string (index behind the last selected charater) |
| text | text that will replace the sub-string |
| void downcase | ( | ) |
Convert all upper-case characters in this string to the corresponding lower-case characters.
| void upcase | ( | ) |
Convert all lower-case characters in this string to the corresponding uppser-case characters.
| String downcased | ( | ) | const |
Return a copy of this string with all upper-case characters converted to the corresponding lower-case characters
| String upcased | ( | ) | const |
Return a copy of this string with all lower-case characters converted to the corresponding upper-case characters
| void trim | ( | const char * | ls = " \t\n\r", |
| const char * | ts = nullptr ) |
Remove leading and trailing whitespace.
| ls | Set of characters to detect as leading whitespace |
| ts | Set of characters to detect as trailing whitespace |
Remove leading and trailing whitespace.
| ls | Set of characters to detect as leading whitespace |
| ts | Set of characters to detect as trailing whitespace |
| void trimBom | ( | ) |
Remove a UTF-8 encoded Byte Order Mark (BOM) if present.
| String trimmed | ( | const char * | ls = " \t\n\r", |
| const char * | ts = nullptr ) const |
Obtain a copy of this string with leading and trailing whitespace removed.
| ls | Set of characters to detect as leading whitespace |
| ts | Set of characters to detect as trailing whitespace |
Obtain a copy of this string with leading and trailing whitespace removed.
| ls | Set of characters to detect as leading whitespace |
| ts | Set of characters to detect as trailing whitespace |
| void trimLeading | ( | const char * | ws = " \t\n\r" | ) |
Remove leading whitespace.
| ws | &Set of characters to detect as whitespace |
| void trimLeading | ( | const String & | ws | ) |
Remove leading whitespace.
| ws | &Set of characters to detect as whitespace |
| String leadingTrimmed | ( | const char * | ws = " \t\n\r" | ) | const |
Obtain a copy of this string with leading whitespace removed.
| ws | Set of characters to detect as whitespace |
Obtain a copy of this string with leading whitespace removed.
| ws | Set of characters to detect as whitespace |
| void trimTrailing | ( | const char * | ws = " \t\n\r" | ) |
Remove trailing whitespace.
| ws | Set of characters to detect as whitespace |
| void trimTrailing | ( | const String & | ws | ) |
Remove trailing whitespace.
| ws | Set of characters to detect as whitespace |
| String trailingTrimmed | ( | const char * | ws = " \t\n\r" | ) | const |
Obtain a copy of this string with trailing whitespace removed.
| ws | Set of characters to detect as whitespace |
Obtain a copy of this string with trailing whitespace removed.
| ws | Set of characters to detect as whitespace |
| void simplify | ( | const char * | ws = " \t\n\r" | ) |
Replace multi-character whitespace sequences within this string by single space characters.
| ws | et of characters to detect as whitespace |
| void simplify | ( | const String & | ws | ) |
Replace multi-character whitespace sequences within this string by single space characters.
| ws | et of characters to detect as whitespace |
| String simplified | ( | const char * | ws = " \t\n\r" | ) | const |
Replace multi-character whitespace sequences within this string by single space characters.
| ws | et of characters to detect as whitespace |
Replace multi-character whitespace sequences within this string by single space characters.
| ws | et of characters to detect as whitespace |
| void escape | ( | ) |
Replace all non-printable and non-ASCII characters by escape sequences.
| String escaped | ( | ) | const |
Replace all non-printable and non-ASCII characters by escape sequences.
| void expand | ( | ) |
Replace escape sequences by their character value or multi-byte representation.
| String expanded | ( | ) |
Replace escape sequences by their character value or multi-byte representation.
Read this string as a boolean value.
| ok | Returns true if this string can be completely read as a boolean value literal |
Read this string as an integer number.
| ok | Returns true if this string can be completely read as an integer number literal |
Read this string as an long integer number.
| ok | Returns true if this string can be completely read as a long integer number literal |
Read this string as an floating point number.
| ok | Returns true if this string can be completely read as a floating point number literal |
| bool read | ( | Out< T > | value | ) | const |
Read this string as a value ot type T.
| value | Returns the parsed value, if successful |
| bool readNumber | ( | Out< T > | value | ) | const |
Read this string as a number of type T.
| base | Number base |
| value | Returns the parsed value, if successful |
| bool readNumberInRange | ( | long | i0, |
| long | i1, | ||
| Out< T > | value ) const |
Read the sub-string in range [i0, i1) as a number of type T.
| base | Number base |
| i0 | Begin of sub-string (index of first selected character) |
| i1 | End of sub-string (index behind the last selected charater) |
| value | Returns the parsed value, if successful |
| iterator begin | ( | ) |
Return iterator pointing to the first item (if any)
| iterator end | ( | ) |
Return iterator pointing behind the last item
| const_iterator begin | ( | ) | const |
Return readonly iterator pointing to the first item (if any)
| const_iterator cbegin | ( | ) | const |
Return readonly iterator pointing to the first item (if any)
| const_iterator end | ( | ) | const |
Return readonly iterator pointing behind the last item
| const_iterator cend | ( | ) | const |
Return readonly iterator pointing behind the last item
| reverse_iterator rbegin | ( | ) |
Return reverse iterator pointing to the last item (if any)
| reverse_iterator rend | ( | ) |
Return reverse iterator pointing before the first item
| const_reverse_iterator rbegin | ( | ) | const |
Return readonly reverse iterator pointing to the last item (if any)
| const_reverse_iterator crbegin | ( | ) | const |
Return readonly reverse iterator pointing to the last item (if any)
| const_reverse_iterator rend | ( | ) | const |
Return reverse iterator pointing before the first item
| const_reverse_iterator crend | ( | ) | const |
Return reverse iterator pointing before the first item
| bool isRootPath | ( | ) | const |
Check if this path points to the root directory.
| bool isAbsolutePath | ( | ) | const |
Check if this path is an absolute path.
| bool isRelativePath | ( | ) | const |
Check if this path is a relative path.
| bool isHerePath | ( | ) | const |
Check if this is a here path (e.g.
"." or "././")
Convert to an absolute path.
| currentDir | Absolute path to the current directory |
| String fileName | ( | ) | const |
Return the file name component of this path
| String baseName | ( | ) | const |
Return the file name of this path without the file type suffix
| String fileSuffix | ( | ) | const |
Return the file type suffix of this path
| String longBaseName | ( | ) | const |
| String shortFileSuffix | ( | ) | const |
Return the short file type suffix of this path
| String sansFileSuffix | ( | ) | const |
Return the same file path without the file name's suffix
| String cdUp | ( | ) | const |
Convenience method, equivalent to cd("..")
| String canonicalPath | ( | ) | const |
Remove redundant and ambigous components from this path.
| bool operator== | ( | const String & | other | ) | const |
Equality operator.
| std::strong_ordering operator<=> | ( | const String & | other | ) | const |
Ordering operator.
| std::strong_ordering operator<=> | ( | const char * | other | ) | const |
Ordering operator.
| bool isCString | ( | ) | const |
Check if this string is zero-terminated.
| String cString | ( | ) | const |
Return a zero-terminated version of this string
| const Bytes & asBytes | ( | ) | const |
Return this string as byte array
| operator char * | ( | ) |
Automatic conversion to low-level C-string.
| operator const char * | ( | ) | const |
Automatic conversion to low-level C-string.
|
explicit |
Automatic conversion to low-level data pointer.
|
explicit |
Automatic conversion to constant low-level data pointer.