| 197 | } |
| 198 | |
| 199 | bool split_string(std::vector<std::string> *out, |
| 200 | const std::string &str, const std::string &separator, bool squash_empty) |
| 201 | { |
| 202 | out->clear(); |
| 203 | |
| 204 | size_t start = 0, pos; |
| 205 | |
| 206 | if (!separator.empty()) |
| 207 | { |
| 208 | while ((pos = str.find(separator,start)) != std::string::npos) |
| 209 | { |
| 210 | if (pos > start || !squash_empty) |
| 211 | out->push_back(str.substr(start, pos-start)); |
| 212 | start = pos + separator.size(); |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | if (start < str.size() || !squash_empty) |
| 217 | out->push_back(str.substr(start)); |
| 218 | |
| 219 | return out->size() > 1; |
| 220 | } |
| 221 | |
| 222 | std::string join_strings(const std::string &separator, const std::vector<std::string> &items) |
| 223 | { |
no test coverage detected