| 48 | } // namespace |
| 49 | |
| 50 | void base::split_string(const std::string& string, |
| 51 | std::vector<std::string>& parts, |
| 52 | const std::string& separators) |
| 53 | { |
| 54 | const std::size_t elements = |
| 55 | 1 + std::count_if(string.begin(), string.end(), is_separator(&separators)); |
| 56 | parts.reserve(elements); |
| 57 | |
| 58 | std::size_t beg = 0, end; |
| 59 | while (true) { |
| 60 | end = string.find_first_of(separators, beg); |
| 61 | if (end != std::string::npos) { |
| 62 | parts.push_back(string.substr(beg, end - beg)); |
| 63 | beg = end + 1; |
| 64 | } |
| 65 | else { |
| 66 | parts.push_back(string.substr(beg)); |
| 67 | break; |
| 68 | } |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | void base::split_string(const std::string_view& string, |
| 73 | std::vector<std::string_view>& parts, |
nothing calls this directly
no test coverage detected