| 12 | { |
| 13 | |
| 14 | vector<string> split(const string &str, char delim, |
| 15 | bool include_empty) |
| 16 | { |
| 17 | |
| 18 | std::stringstream ss; |
| 19 | ss.str(str); |
| 20 | std::string item; |
| 21 | |
| 22 | vector<string> result; |
| 23 | |
| 24 | auto inserter = std::back_inserter(result); |
| 25 | |
| 26 | while (std::getline(ss, item, delim)) |
| 27 | { |
| 28 | if (!item.empty() || include_empty) |
| 29 | *(inserter++) = item; |
| 30 | } |
| 31 | |
| 32 | return result; |
| 33 | } |
| 34 | |
| 35 | string join(const vector<string>& strs, char sep) { |
| 36 | std::stringstream ss; |
no test coverage detected