| 26 | |
| 27 | |
| 28 | void StrSplitList(const string &str, const string &delimiters, vector<std::string> &results) { |
| 29 | results.clear(); |
| 30 | auto last = 0; |
| 31 | auto found = str.find_first_of(delimiters); |
| 32 | while (string::npos != found) { |
| 33 | auto r = str.substr(last, found - last); |
| 34 | last = found + 1; |
| 35 | found = str.find_first_of(delimiters, last); |
| 36 | if (!r.empty()) results.push_back(r); |
| 37 | } |
| 38 | auto r = str.substr(last); |
| 39 | if (!r.empty()) results.push_back(r); |
| 40 | } |
| 41 | |
| 42 | |
| 43 | } // namespace utils |