| 32 | |
| 33 | |
| 34 | void StrTrim(string *str, const char *to_trim) { |
| 35 | string::size_type start_pos = 0; |
| 36 | string::size_type end_pos = 0; |
| 37 | |
| 38 | start_pos = str->find_first_not_of(to_trim); |
| 39 | |
| 40 | end_pos = str->find_last_not_of(to_trim); |
| 41 | |
| 42 | if (start_pos == string::npos || end_pos == string::npos) { |
| 43 | *str = ""; |
| 44 | } else { |
| 45 | *str = str->substr(start_pos, end_pos - start_pos + 1); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | void StrReplaceAll(string *haystack, string needle, string s) { |
| 50 | string::size_type pos = 0; |
no outgoing calls
no test coverage detected