| 68 | } |
| 69 | |
| 70 | std::string TrimString(const std::string& str, const std::string& trim) { |
| 71 | std::string::size_type pos = str.find_first_not_of(trim); |
| 72 | if (pos == std::string::npos) { |
| 73 | return str; |
| 74 | } |
| 75 | std::string::size_type pos2 = str.find_last_not_of(trim); |
| 76 | if (pos2 != std::string::npos) { |
| 77 | return str.substr(pos, pos2 - pos + 1); |
| 78 | } |
| 79 | return str.substr(pos); |
| 80 | } |
| 81 | |
| 82 | bool StringEndsWith(const std::string& str, const std::string& sub_str) { |
| 83 | if (str.length() < sub_str.length()) { |
no outgoing calls