| 329 | } |
| 330 | |
| 331 | StringList String::splitAny(String const& chars, size_t maxSplit) const { |
| 332 | StringList ret; |
| 333 | String next; |
| 334 | bool doneSplitting = false; |
| 335 | for (auto c : *this) { |
| 336 | if (!doneSplitting && chars.hasCharOrWhitespace(c)) { |
| 337 | if (!next.empty()) |
| 338 | ret.append(take(next)); |
| 339 | } else { |
| 340 | if (ret.size() == maxSplit) |
| 341 | doneSplitting = true; |
| 342 | next.append(c); |
| 343 | } |
| 344 | } |
| 345 | if (!next.empty()) |
| 346 | ret.append(std::move(next)); |
| 347 | return ret; |
| 348 | } |
| 349 | |
| 350 | StringList String::rsplitAny(String const& chars, size_t maxSplit) const { |
| 351 | // This is really inefficient! |