| 485 | |
| 486 | template <typename StringType> |
| 487 | static void DoStringTrim(StringType* str) |
| 488 | { |
| 489 | size_t start_pos = 0; |
| 490 | size_t end_pos = str->length(); |
| 491 | while (start_pos != end_pos && isspace((*str)[start_pos])) |
| 492 | start_pos++; |
| 493 | if (start_pos == end_pos) |
| 494 | { |
| 495 | str->clear(); |
| 496 | return; |
| 497 | } |
| 498 | end_pos--; |
| 499 | while (isspace((*str)[end_pos])) // end_pos always >= 0 |
| 500 | end_pos--; |
| 501 | *str = str->substr(start_pos, end_pos - start_pos + 1); |
| 502 | } |
| 503 | |
| 504 | void StringTrim(std::string* str) |
| 505 | { |
no test coverage detected