| 4328 | } |
| 4329 | |
| 4330 | String String::strip_edges(bool left, bool right) const |
| 4331 | { |
| 4332 | int len = length(); |
| 4333 | int beg = 0, end = len; |
| 4334 | |
| 4335 | if (left) |
| 4336 | { |
| 4337 | for (int i = 0; i < len; i++) |
| 4338 | { |
| 4339 | if (operator[](i) <= 32) |
| 4340 | { |
| 4341 | beg++; |
| 4342 | } |
| 4343 | else |
| 4344 | { |
| 4345 | break; |
| 4346 | } |
| 4347 | } |
| 4348 | } |
| 4349 | |
| 4350 | if (right) |
| 4351 | { |
| 4352 | for (int i = len - 1; i >= 0; i--) |
| 4353 | { |
| 4354 | if (operator[](i) <= 32) |
| 4355 | { |
| 4356 | end--; |
| 4357 | } |
| 4358 | else |
| 4359 | { |
| 4360 | break; |
| 4361 | } |
| 4362 | } |
| 4363 | } |
| 4364 | |
| 4365 | if (beg == 0 && end == len) |
| 4366 | { |
| 4367 | return *this; |
| 4368 | } |
| 4369 | |
| 4370 | return substr(beg, end - beg); |
| 4371 | } |
| 4372 | |
| 4373 | String String::strip_escapes() const |
| 4374 | { |
no test coverage detected