29 #ifndef String_class_h 30 #define String_class_h 43 class __FlashStringHelper;
59 typedef void (
String::*StringIfHelperType)()
const;
60 void StringIfHelper()
const {}
74 String(
const char *cstr =
"");
92 #ifndef DOXYGEN_DO_NOT_DOCUMENT 93 String(
const __FlashStringHelper *pstr);
106 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 125 explicit String(
unsigned char b,
unsigned char base=10);
134 explicit String(
int value,
unsigned char base=10);
143 explicit String(
unsigned int value,
unsigned char base=10);
152 explicit String(
long value,
unsigned char base=10);
161 explicit String(
unsigned long value,
unsigned char base=10);
170 explicit String(
float value,
int decimalPlaces=6);
179 explicit String(
double value,
int decimalPlaces=6);
201 unsigned char reserve(
unsigned int size);
228 #ifndef DOXYGEN_DO_NOT_DOCUMENT 231 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 241 operator const char*()
const {
return c_str(); }
265 unsigned char concat(
const char *cstr);
266 #ifndef DOXYGEN_DO_NOT_DOCUMENT 267 unsigned char concat(
const __FlashStringHelper * str);
276 unsigned char concat(
char c);
285 unsigned char concat(
unsigned char c);
294 unsigned char concat(
int num);
303 unsigned char concat(
unsigned int num);
312 unsigned char concat(
long num);
321 unsigned char concat(
unsigned long num);
330 unsigned char concat(
float num);
339 unsigned char concat(
double num);
534 #ifndef DOXYGEN_DO_NOT_DOCUMENT 536 operator StringIfHelperType()
const {
return buffer ? &String::StringIfHelper : 0; }
573 unsigned char equals(
const char *cstr)
const;
726 char charAt(
unsigned int index)
const;
738 void setCharAt(
unsigned int index,
char c);
776 void getBytes(
unsigned char *buf,
unsigned int bufsize,
unsigned int index=0)
const;
792 void toCharArray(
char *buf,
unsigned int bufsize,
unsigned int index=0)
const 793 {
getBytes((
unsigned char *)buf, bufsize, index);}
847 int indexOf(
char ch,
unsigned int fromIndex )
const;
873 int indexOf(
const String &str,
unsigned int fromIndex )
const;
899 int lastIndexOf(
char ch,
unsigned int fromIndex )
const;
953 String substring(
unsigned int beginIndex,
unsigned int endIndex )
const;
987 String&
remove(
unsigned int index);
1000 String&
remove(
unsigned int index,
unsigned int count);
1037 long toInt(
void)
const;
1063 #ifndef DOXYGEN_DO_NOT_DOCUMENT 1065 void invalidate(
void);
1066 unsigned char changeBuffer(
unsigned int maxStrLen);
1067 unsigned char concat(
const char *cstr,
unsigned int length);
1071 String & copy(
const __FlashStringHelper *pstr,
unsigned int length);
1074 #ifdef __GXX_EXPERIMENTAL_CXX0X__ 1078 friend class StringPrintableHelper;
1161 #ifndef DOXYGEN_DO_NOT_DOCUMENT 1163 std::ostream& operator << ( std::ostream& os,
const String& value );
1168 #endif // String_class_h unsigned char operator==(const String &rhs) const
Returns true if this string is equal to another string (case-sensitive)
Definition: spark_wiring_string.h:585
unsigned char equalsIgnoreCase(const String &s) const
Returns true if this string equals another string (case-insensitive)
String substring(unsigned int beginIndex) const
Returns a String object with a copy of the characters starting at beginIndex through the end of the s...
String & toUpperCase(void)
Converts this String to upper case, modifying it in place.
unsigned char flags
Unused, for future features.
Definition: spark_wiring_string.h:1061
StringSumHelper(unsigned char num)
Append a byte as a decimal number 0 - 255.
Definition: spark_wiring_string.h:1122
int lastIndexOf(char ch) const
Search this string for a given character, starting at the end.
StringSumHelper(unsigned long num)
Append a 32-bit unsigned long as a decimal number.
Definition: spark_wiring_string.h:1158
float toFloat(void) const
Converts this string to a float (single precision floating point value)
void setCharAt(unsigned int index, char c)
Set the character at offset index.
char charAt(unsigned int index) const
Gets the character at offset index.
unsigned char startsWith(const String &prefix) const
Returns true if this string starts with prefix (case-sensitive)
friend StringSumHelper & operator+(const StringSumHelper &lhs, const String &rhs)
Append (concatenate) a String to the end of lhs.
String & trim(void)
Removes leading an trailing white spaces from this string, modifying it in place. ...
unsigned char reserve(unsigned int size)
Reserves a buffer of size.
unsigned int capacity
The capacity of the buffer. The longest string is one byte less than this.
Definition: spark_wiring_string.h:1059
StringSumHelper(unsigned int num)
Append a 32-bit unsigned integer as a decimal number.
Definition: spark_wiring_string.h:1140
String(const char *cstr="")
Construct a String object from a c-string (null-terminated)
unsigned char operator>(const String &rhs) const
Returns true if this string is greater than to another string (case-sensitive)
char * buffer
The buffer containing the data. It is always null-terminated.
Definition: spark_wiring_string.h:1058
int compareTo(const String &s) const
Compares this string to another string using strcmp (case-sensitive)
String & operator=(const String &rhs)
Assigns this string to have a copy of String rhs.
StringSumHelper(const char *p)
Append a const char * (c-string, null terminated)
Definition: spark_wiring_string.h:1104
unsigned char concat(const String &str)
Append (concatenate) a String object to the end of this String, modifying this string in place...
char operator[](unsigned int index) const
Gets the character at offset index.
Class used when appending mutiple String and other values using +.
Definition: spark_wiring_string.h:1085
unsigned char operator<(const String &rhs) const
Returns true if this string is less than to another string (case-sensitive)
String & toLowerCase(void)
Converts this String to lower case, modifying it in place.
The Printable class provides a way for new classes to allow themselves to be printed.
Definition: spark_wiring_printable.h:41
StringSumHelper(const String &s)
Append a String object.
Definition: spark_wiring_string.h:1095
StringSumHelper(int num)
Append a 32-bit signed integer as a decimal number.
Definition: spark_wiring_string.h:1131
long toInt(void) const
Converts this string to a signed integer (32-bit)
int indexOf(char ch) const
Search this string for a given character.
StringSumHelper(char c)
Append a single character.
Definition: spark_wiring_string.h:1113
StringSumHelper(long num)
Append a 32-bit long integer as a decimal number.
Definition: spark_wiring_string.h:1149
unsigned int length(void) const
Returns the length of the string in bytes.
Definition: spark_wiring_string.h:208
Header for spark_wiring_printable.cpp module.
String & replace(char find, char replace)
Replaces every occurrence of a character in the string with another character, modifying it in place...
Header for spark_wiring_print.c module.
static String format(const char *format,...)
Uses sprintf-style formatting to build a String object [static].
unsigned char operator!=(const String &rhs) const
Returns true if this string is greater than to another string (case-sensitive)
Definition: spark_wiring_string.h:610
const char * c_str() const
Returns a c-string (null-terminated)
Definition: spark_wiring_string.h:819
unsigned char equals(const String &s) const
Returns true if this string is equal to another string (case-sensitive)
unsigned char operator<=(const String &rhs) const
Returns true if this string is less than or equal to another string (case-sensitive) ...
~String(void)
Destructor. Also deletes the underlying dynamically allocated string.
unsigned int len
The String length (not counting the null terminator).
Definition: spark_wiring_string.h:1060
unsigned char endsWith(const String &suffix) const
Returns true if this string ends with suffix (case-sensitive)
void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const
Copy the data out of this String into another buffer.
Definition: spark_wiring_string.h:792
void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index=0) const
Copy the data out of this String into another buffer.
Wiring String: A class to hold and manipulate a dynamically allocated string.
Definition: spark_wiring_string.h:54
String & operator+=(const String &rhs)
Appends (concatenate) a String object to the end of this String, modifying this string in place...
Definition: spark_wiring_string.h:352
unsigned char operator>=(const String &rhs) const
Returns true if this string is greater than or equal to another string (case-sensitive) ...