Split a string on every instance of sep, returning a vector. */
| 415 | |
| 416 | /** Split a string on every instance of sep, returning a vector. */ |
| 417 | std::vector<Span<const char>> Split(const Span<const char>& sp, char sep) |
| 418 | { |
| 419 | std::vector<Span<const char>> ret; |
| 420 | auto it = sp.begin(); |
| 421 | auto start = it; |
| 422 | while (it != sp.end()) { |
| 423 | if (*it == sep) { |
| 424 | ret.emplace_back(start, it); |
| 425 | start = it + 1; |
| 426 | } |
| 427 | ++it; |
| 428 | } |
| 429 | ret.emplace_back(start, it); |
| 430 | return ret; |
| 431 | } |
| 432 | |
| 433 | /** Parse a key path, being passed a split list of elements (the first element is ignored). */ |
| 434 | bool ParseKeyPath(const std::vector<Span<const char>>& split, KeyPath& out) |
no test coverage detected