| 6 | // Empty tokens will not be included in the result. |
| 7 | |
| 8 | vector<string> |
| 9 | tokenizeString(const string &s, const string &delims, bool allowEmptyTokens) |
| 10 | { |
| 11 | size_t offset = -1; |
| 12 | |
| 13 | vector<string>tokens; |
| 14 | |
| 15 | do { |
| 16 | offset += 1; |
| 17 | size_t j = s.find_first_of(delims, offset); |
| 18 | |
| 19 | string token = s.substr(offset, j - offset); |
| 20 | |
| 21 | if (allowEmptyTokens || token.length() > 0) { |
| 22 | tokens.push_back(token); |
| 23 | } |
| 24 | |
| 25 | offset = j; |
| 26 | } while (offset != string::npos); |
| 27 | |
| 28 | return tokens; |
| 29 | } |
| 30 | } // namespace dmtcp |
no outgoing calls
no test coverage detected