| 53 | } |
| 54 | |
| 55 | vector<string> StringOperations::tokenize(const string& str, const string& delimiter) |
| 56 | { |
| 57 | vector<string> tokens; |
| 58 | string tempString = str; |
| 59 | size_t pos = 0; |
| 60 | |
| 61 | while ((pos = tempString.find(delimiter)) != string::npos) { |
| 62 | tokens.push_back(tempString.substr(0, pos)); |
| 63 | tempString.erase(0, pos + delimiter.size()); |
| 64 | } |
| 65 | tokens.push_back(tempString); |
| 66 | |
| 67 | return tokens; |
| 68 | } |
| 69 | |
| 70 | } |