@@ -101,11 +101,7 @@ class String {
101
101
String &operator =(const char *cstr);
102
102
String &operator =(const __FlashStringHelper *str);
103
103
String &operator =(String &&rval) noexcept ;
104
- String &operator =(char c) {
105
- char buffer[2 ] { c, ' \0 ' };
106
- *this = buffer;
107
- return *this ;
108
- }
104
+ String &operator =(char c);
109
105
110
106
// concatenate (works w/ built-in types)
111
107
@@ -142,39 +138,40 @@ class String {
142
138
int compareTo (const String &s) const ;
143
139
bool equals (const String &s) const ;
144
140
bool equals (const char *cstr) const ;
141
+ bool equals (const __FlashStringHelper *s) const ;
145
142
bool operator ==(const String &rhs) const {
146
143
return equals (rhs);
147
144
}
148
145
bool operator ==(const char *cstr) const {
149
146
return equals (cstr);
150
147
}
148
+ bool operator ==(const __FlashStringHelper *rhs) const {
149
+ return equals (rhs);
150
+ }
151
151
bool operator !=(const String &rhs) const {
152
152
return !equals (rhs);
153
153
}
154
154
bool operator !=(const char *cstr) const {
155
155
return !equals (cstr);
156
156
}
157
+ bool operator !=(const __FlashStringHelper *rhs) const {
158
+ return !equals (rhs);
159
+ }
157
160
bool operator <(const String &rhs) const ;
158
161
bool operator >(const String &rhs) const ;
159
162
bool operator <=(const String &rhs) const ;
160
163
bool operator >=(const String &rhs) const ;
161
164
bool equalsIgnoreCase (const String &s) const ;
165
+ bool equalsIgnoreCase (const __FlashStringHelper *s) const ;
162
166
unsigned char equalsConstantTime (const String &s) const ;
163
167
bool startsWith (const String &prefix) const ;
164
- bool startsWith (const char *prefix) const {
165
- return this ->startsWith (String (prefix));
166
- }
167
- bool startsWith (const __FlashStringHelper *prefix) const {
168
- return this ->startsWith (String (prefix));
169
- }
168
+ bool startsWith (const char *prefix) const ;
169
+ bool startsWith (const __FlashStringHelper *prefix) const ;
170
170
bool startsWith (const String &prefix, unsigned int offset) const ;
171
+ bool startsWith (const __FlashStringHelper *prefix, unsigned int offset) const ;
171
172
bool endsWith (const String &suffix) const ;
172
- bool endsWith (const char *suffix) const {
173
- return this ->endsWith (String (suffix));
174
- }
175
- bool endsWith (const __FlashStringHelper *suffix) const {
176
- return this ->endsWith (String (suffix));
177
- }
173
+ bool endsWith (const char *suffix) const ;
174
+ bool endsWith (const __FlashStringHelper *suffix) const ;
178
175
179
176
// character access
180
177
char charAt (unsigned int index) const {
@@ -204,6 +201,8 @@ class String {
204
201
int lastIndexOf (char ch, unsigned int fromIndex) const ;
205
202
int lastIndexOf (const String &str) const ;
206
203
int lastIndexOf (const String &str, unsigned int fromIndex) const ;
204
+ int lastIndexOf (const __FlashStringHelper *str) const ;
205
+ int lastIndexOf (const __FlashStringHelper *str, unsigned int fromIndex) const ;
207
206
String substring (unsigned int beginIndex) const {
208
207
return substring (beginIndex, len ());
209
208
}
@@ -212,21 +211,12 @@ class String {
212
211
// modification
213
212
void replace (char find, char replace);
214
213
void replace (const String &find, const String &replace);
215
- void replace (const char *find, const String &replace) {
216
- this ->replace (String (find), replace);
217
- }
218
- void replace (const __FlashStringHelper *find, const String &replace) {
219
- this ->replace (String (find), replace);
220
- }
221
- void replace (const char *find, const char *replace) {
222
- this ->replace (String (find), String (replace));
223
- }
224
- void replace (const __FlashStringHelper *find, const char *replace) {
225
- this ->replace (String (find), String (replace));
226
- }
227
- void replace (const __FlashStringHelper *find, const __FlashStringHelper *replace) {
228
- this ->replace (String (find), String (replace));
229
- }
214
+ void replace (const char *find, const String &replace);
215
+ void replace (const __FlashStringHelper *find, const String &replace);
216
+ void replace (const char *find, const char *replace);
217
+ void replace (const __FlashStringHelper *find, const char *replace);
218
+ void replace (const __FlashStringHelper *find, const __FlashStringHelper *replace);
219
+
230
220
// Pass the biggest integer if the count is not specified.
231
221
// The remove method below will take care of truncating it at the end of the string.
232
222
void remove (unsigned int index, unsigned int count = (unsigned int )-1);
0 commit comments