112:fa2f00081357 | 113:bbaa40226ec9 |
---|---|
283 append (s2); | 283 append (s2); |
284 } | 284 } |
285 } | 285 } |
286 | 286 |
287 // ============================================================================ | 287 // ============================================================================ |
288 void str::strip (char c) { | 288 str str::strip (char c) { |
289 strip ({c}); | 289 return strip ({c}); |
290 } | 290 } |
291 | 291 |
292 void str::strip (std::initializer_list<char> unwanted) { | 292 str str::strip (std::initializer_list<char> unwanted) { |
293 str cache = text; | 293 str cache = text; |
294 uint oldlen = len(); | 294 uint oldlen = len(); |
295 | 295 |
296 char* buf = new char[oldlen]; | 296 char* buf = new char[oldlen]; |
297 char* bufptr = buf; | 297 char* bufptr = buf; |
306 } | 306 } |
307 | 307 |
308 *bufptr = '\0'; | 308 *bufptr = '\0'; |
309 assert (bufptr <= buf + oldlen); | 309 assert (bufptr <= buf + oldlen); |
310 | 310 |
311 clear(); | 311 str zResult = buf; |
312 append (buf); | |
313 | |
314 delete[] buf; | 312 delete[] buf; |
313 | |
314 return zResult; | |
315 } | 315 } |
316 | 316 |
317 void str::insert (char* c, unsigned int pos) { | 317 void str::insert (char* c, unsigned int pos) { |
318 str s1 = substr (0, pos); | 318 str s1 = substr (0, pos); |
319 str s2 = substr (pos, len()); | 319 str s2 = substr (pos, len()); |