| 64 | |
| 65 | template <typename STR> |
| 66 | void SplitStringUsingSubstrT(const STR& str, |
| 67 | const STR& s, |
| 68 | std::vector<STR>* r) { |
| 69 | r->clear(); |
| 70 | typename STR::size_type begin_index = 0; |
| 71 | while (true) { |
| 72 | const typename STR::size_type end_index = str.find(s, begin_index); |
| 73 | if (end_index == STR::npos) { |
| 74 | const STR term = str.substr(begin_index); |
| 75 | STR tmp; |
| 76 | TrimWhitespace(term, TRIM_ALL, &tmp); |
| 77 | r->push_back(tmp); |
| 78 | return; |
| 79 | } |
| 80 | const STR term = str.substr(begin_index, end_index - begin_index); |
| 81 | STR tmp; |
| 82 | TrimWhitespace(term, TRIM_ALL, &tmp); |
| 83 | r->push_back(tmp); |
| 84 | begin_index = end_index + s.size(); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | template<typename STR> |
| 89 | void SplitStringAlongWhitespaceT(const STR& str, std::vector<STR>* result) { |
no test coverage detected