@@ -69,6 +69,8 @@ class String
69
69
explicit String (unsigned int , unsigned char base=10 );
70
70
explicit String (long , unsigned char base=10 );
71
71
explicit String (unsigned long , unsigned char base=10 );
72
+ explicit String (float , int decimalPlaces=6 );
73
+ explicit String (double , int decimalPlaces=6 );
72
74
~String (void );
73
75
74
76
// memory management
@@ -102,6 +104,8 @@ class String
102
104
unsigned char concat (unsigned int num);
103
105
unsigned char concat (long num);
104
106
unsigned char concat (unsigned long num);
107
+ unsigned char concat (float num);
108
+ unsigned char concat (double num);
105
109
unsigned char concat (const __FlashStringHelper * str);
106
110
107
111
// if there's not enough memory for the concatenated value, the string
@@ -114,6 +118,8 @@ class String
114
118
String & operator += (unsigned int num) {concat (num); return (*this );}
115
119
String & operator += (long num) {concat (num); return (*this );}
116
120
String & operator += (unsigned long num) {concat (num); return (*this );}
121
+ String & operator += (float num) {concat (num); return (*this );}
122
+ String & operator += (double num) {concat (num); return (*this );}
117
123
String & operator += (const __FlashStringHelper *str){concat (str); return (*this );}
118
124
119
125
friend StringSumHelper & operator + (const StringSumHelper &lhs, const String &rhs);
@@ -124,6 +130,8 @@ class String
124
130
friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned int num);
125
131
friend StringSumHelper & operator + (const StringSumHelper &lhs, long num);
126
132
friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num);
133
+ friend StringSumHelper & operator + (const StringSumHelper &lhs, float num);
134
+ friend StringSumHelper & operator + (const StringSumHelper &lhs, double num);
127
135
friend StringSumHelper & operator + (const StringSumHelper &lhs, const __FlashStringHelper *rhs);
128
136
129
137
// comparison (only works w/ Strings and "strings")
@@ -169,12 +177,15 @@ class String
169
177
// modification
170
178
void replace (char find, char replace);
171
179
void replace (const String& find, const String& replace);
180
+ void remove (unsigned int index);
181
+ void remove (unsigned int index, unsigned int count);
172
182
void toLowerCase (void );
173
183
void toUpperCase (void );
174
184
void trim (void );
175
185
176
186
// parsing/conversion
177
187
long toInt (void ) const ;
188
+ float toFloat (void ) const ;
178
189
179
190
protected:
180
191
char *buffer; // the actual char array
@@ -206,6 +217,8 @@ class StringSumHelper : public String
206
217
StringSumHelper (unsigned int num) : String(num) {}
207
218
StringSumHelper (long num) : String(num) {}
208
219
StringSumHelper (unsigned long num) : String(num) {}
220
+ StringSumHelper (float num) : String(num) {}
221
+ StringSumHelper (double num) : String(num) {}
209
222
};
210
223
211
224
#endif // __cplusplus
0 commit comments