23 #ifndef String_class_h 24 #define String_class_h 32 #define F(string_literal) string_literal 44 typedef void (
String::*StringIfHelperType)()
const;
45 void StringIfHelper()
const {}
53 String(
const char *cstr =
"");
55 #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) 60 explicit String(
unsigned char,
unsigned char base=10);
61 explicit String(
int,
unsigned char base=10);
62 explicit String(
unsigned int,
unsigned char base=10);
63 explicit String(
long,
unsigned char base=10);
64 explicit String(
unsigned long,
unsigned char base=10);
65 explicit String(
float,
unsigned char decimalPlaces=2);
66 explicit String(
double,
unsigned char decimalPlaces=2);
73 unsigned char reserve(
unsigned int size);
74 inline unsigned int length(
void)
const {
return len;}
80 String & operator = (
const char *cstr);
81 #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) 91 unsigned char concat(
const String &str);
92 unsigned char concat(
const char *cstr);
93 unsigned char concat(
char c);
94 unsigned char concat(
unsigned char c);
95 unsigned char concat(
int num);
96 unsigned char concat(
unsigned int num);
97 unsigned char concat(
long num);
98 unsigned char concat(
unsigned long num);
99 unsigned char concat(
float num);
100 unsigned char concat(
double num);
104 String & operator += (
const String &rhs) {concat(rhs);
return (*
this);}
105 String & operator += (
const char *cstr) {concat(cstr);
return (*
this);}
106 String & operator += (
char c) {concat(c);
return (*
this);}
107 String & operator += (
unsigned char num) {concat(num);
return (*
this);}
108 String & operator += (
int num) {concat(num);
return (*
this);}
109 String & operator += (
unsigned int num) {concat(num);
return (*
this);}
110 String & operator += (
long num) {concat(num);
return (*
this);}
111 String & operator += (
unsigned long num) {concat(num);
return (*
this);}
112 String & operator += (
float num) {concat(num);
return (*
this);}
113 String & operator += (
double num) {concat(num);
return (*
this);}
127 operator StringIfHelperType()
const {
return buffer ? &String::StringIfHelper : 0; }
128 int compareTo(
const String &s)
const;
129 unsigned char equals(
const String &s)
const;
130 unsigned char equals(
const char *cstr)
const;
131 unsigned char operator == (
const String &rhs)
const {
return equals(rhs);}
132 unsigned char operator == (
const char *cstr)
const {
return equals(cstr);}
133 unsigned char operator != (
const String &rhs)
const {
return !equals(rhs);}
134 unsigned char operator != (
const char *cstr)
const {
return !equals(cstr);}
135 unsigned char operator < (
const String &rhs)
const;
136 unsigned char operator > (
const String &rhs)
const;
137 unsigned char operator <= (
const String &rhs)
const;
138 unsigned char operator >= (
const String &rhs)
const;
139 unsigned char equalsIgnoreCase(
const String &s)
const;
140 unsigned char startsWith(
const String &prefix)
const;
141 unsigned char startsWith(
const String &prefix,
unsigned int offset)
const;
142 unsigned char endsWith(
const String &suffix)
const;
145 char charAt(
unsigned int index)
const;
146 void setCharAt(
unsigned int index,
char c);
147 char operator [] (
unsigned int index)
const;
148 char& operator [] (
unsigned int index);
149 void getBytes(
unsigned char *buf,
unsigned int bufsize,
unsigned int index=0)
const;
150 void toCharArray(
char *buf,
unsigned int bufsize,
unsigned int index=0)
const 151 { getBytes((
unsigned char *)buf, bufsize, index); }
152 const char* c_str()
const {
return buffer; }
153 char* begin() {
return buffer; }
154 char* end() {
return buffer + length(); }
155 const char* begin()
const {
return c_str(); }
156 const char* end()
const {
return c_str() + length(); }
159 int indexOf(
char ch )
const;
160 int indexOf(
char ch,
unsigned int fromIndex )
const;
161 int indexOf(
const String &str )
const;
162 int indexOf(
const String &str,
unsigned int fromIndex )
const;
163 int lastIndexOf(
char ch )
const;
164 int lastIndexOf(
char ch,
unsigned int fromIndex )
const;
165 int lastIndexOf(
const String &str )
const;
166 int lastIndexOf(
const String &str,
unsigned int fromIndex )
const;
167 String substring(
unsigned int beginIndex )
const {
return substring(beginIndex, len); };
168 String substring(
unsigned int beginIndex,
unsigned int endIndex )
const;
171 void replace(
char find,
char replace);
172 void replace(
const String& find,
const String& replace);
173 void remove(
unsigned int index);
174 void remove(
unsigned int index,
unsigned int count);
175 void toLowerCase(
void);
176 void toUpperCase(
void);
180 long toInt(
void)
const;
181 float toFloat(
void)
const;
182 double toDouble(
void)
const;
186 unsigned int capacity;
190 void invalidate(
void);
191 unsigned char changeBuffer(
unsigned int maxStrLen);
192 unsigned char concat(
const char *cstr,
unsigned int length);
195 String & copy(
const char *cstr,
unsigned int length);
196 #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__) 216 #endif // __cplusplus 217 #endif // String_class_h Definition: WString.h:201