| 3 | #include <vector> |
| 4 | |
| 5 | std::vector<std::string> |
| 6 | split(const std::string& str, const std::string& delims=" \t") |
| 7 | { |
| 8 | std::vector<std::string> res; |
| 9 | size_t init = 0; |
| 10 | |
| 11 | while (true) { |
| 12 | auto pos = str.find_first_of(delims, init); |
| 13 | if (pos == std::string::npos) { |
| 14 | res.emplace_back(str.substr(init, str.length())); |
| 15 | break; |
| 16 | } |
| 17 | res.emplace_back(str.substr(init, pos - init)); |
| 18 | pos++; |
| 19 | init = pos; |
| 20 | } |
| 21 | |
| 22 | return res; |
| 23 | } |
| 24 | |
| 25 | std::string join(const std::vector<std::string>& vec) |
| 26 | { |