Class to manage a double null-terminated list of strings, such as "one\0two\0three".
More...
|
bool | add (const char *str, unsigned length=0) |
| Append a new string to the end of the array. More...
|
|
bool | add (const String &str) |
| Append a new string to the end of the array. More...
|
|
int | indexOf (const char *str) const |
| Find the given string and return its index. More...
|
|
int | indexOf (const String &str) const |
| Find the given string and return its index. More...
|
|
bool | contains (const char *str) const |
| Check if array contains a string. More...
|
|
bool | contains (const String &str) const |
| Check if array contains a string. More...
|
|
const char * | getValue (unsigned index) const |
| Get string at the given position. More...
|
|
const char * | operator[] (unsigned index) const |
| Get string at the given position. More...
|
|
void | clear () |
| Empty the array. More...
|
|
unsigned | count () const |
| Get quantity of strings in array. More...
|
|
|
void | setString (const char *cstr, int length=-1) |
|
void | setString (flash_string_t pstr, int length=-1) |
|
bool | reserve (unsigned int size) |
|
bool | setLength (unsigned int length) |
| set the string length accordingly, expanding if necessary More...
|
|
unsigned int | length (void) const |
|
bool | concat (const String &str) |
|
bool | concat (const char *cstr) |
|
bool STRING_IRAM_ATTR | concat (const char *cstr, unsigned int length) |
|
bool | concat (char c) |
|
bool | concat (unsigned char c) |
|
bool | concat (int num) |
|
bool | concat (unsigned int num) |
|
bool | concat (long num) |
|
bool | concat (unsigned long num) |
|
bool | concat (float num) |
|
bool | concat (double num) |
|
String & | operator+= (const String &rhs) |
|
String & | operator+= (const char *cstr) |
|
String & | operator+= (char c) |
|
String & | operator+= (unsigned char num) |
|
String & | operator+= (int num) |
|
String & | operator+= (unsigned int num) |
|
String & | operator+= (long num) |
|
String & | operator+= (unsigned long num) |
|
String & | operator+= (float num) |
|
String & | operator+= (double num) |
|
| operator StringIfHelperType () const |
|
int STRING_IRAM_ATTR | compareTo (const String &s) const |
|
bool STRING_IRAM_ATTR | equals (const String &s) const |
|
bool STRING_IRAM_ATTR | equals (const char *cstr) const |
|
bool | equals (const FlashString &fstr) const |
|
bool STRING_IRAM_ATTR | operator== (const String &rhs) const |
|
bool STRING_IRAM_ATTR | operator== (const char *cstr) const |
|
bool STRING_IRAM_ATTR | operator== (const FlashString &fstr) const |
|
bool STRING_IRAM_ATTR | operator!= (const String &rhs) const |
|
bool STRING_IRAM_ATTR | operator!= (const char *cstr) const |
|
bool | operator< (const String &rhs) const |
|
bool | operator> (const String &rhs) const |
|
bool | operator<= (const String &rhs) const |
|
bool | operator>= (const String &rhs) const |
|
bool | equalsIgnoreCase (const char *cstr) const |
|
bool | equalsIgnoreCase (const String &s2) const |
|
bool | equalsIgnoreCase (const FlashString &fstr) const |
|
bool | startsWith (const String &prefix) const |
|
bool | startsWith (const String &prefix, unsigned int offset) const |
|
bool | endsWith (const String &suffix) const |
|
char STRING_IRAM_ATTR | charAt (unsigned int index) const |
|
void STRING_IRAM_ATTR | setCharAt (unsigned int index, char c) |
|
char STRING_IRAM_ATTR | operator[] (unsigned int index) const |
|
char &STRING_IRAM_ATTR | operator[] (unsigned int index) |
|
unsigned int | getBytes (unsigned char *buf, unsigned int bufsize, unsigned int index=0) const |
| read contents of string into a buffer More...
|
|
void | toCharArray (char *buf, unsigned int bufsize, unsigned int index=0) const |
|
const char * | c_str () const |
|
char * | begin () |
|
const char * | begin () const |
|
char * | end () |
|
const char * | end () const |
|
int STRING_IRAM_ATTR | indexOf (char ch) const |
|
int | indexOf (char ch, unsigned int fromIndex) const |
|
int | indexOf (const String &s2, unsigned int fromIndex) const |
|
int | lastIndexOf (char ch) const |
|
int | lastIndexOf (char ch, unsigned int fromIndex) const |
|
int | lastIndexOf (const String &s2) const |
|
int | lastIndexOf (const String &s2, unsigned int fromIndex) const |
|
String | substring (unsigned int beginIndex) const |
|
String | substring (unsigned int beginIndex, unsigned int endIndex) const |
|
void | replace (char find, char replace) |
|
void | replace (const String &find, const String &replace) |
|
void | remove (unsigned int index) |
|
void | remove (unsigned int index, unsigned int count) |
|
void | toLowerCase (void) |
|
void | toUpperCase (void) |
|
void | trim (void) |
|
long | toInt (void) const |
|
float | toFloat (void) const |
|
void STRING_IRAM_ATTR | invalidate (void) |
|
bool STRING_IRAM_ATTR | changeBuffer (unsigned int maxStrLen) |
|
String & | copy (const char *cstr, unsigned int length) |
|
String & | copy (flash_string_t pstr, unsigned int length) |
|
void | move (String &rhs) |
|
Class to manage a double null-terminated list of strings, such as "one\0two\0three".
- Note
Comparison with Vector<String>
Advantages: More memory efficient. Uses only a single heap allocation Useful for simple lookups, e.g. mapping enumerated values to strings
Disadvantages:
Slower. Items must be iterated using multiple strlen() calls
Ordering not supported
Insertions / deletions not supported (yet)