| 133 | { |
| 134 | template<class ReturnType, class InputType = ReturnType> |
| 135 | inline void split(std::vector<ReturnType>& _ret, const InputType& _source, const InputType& _delims) |
| 136 | { |
| 137 | size_t start = _source.find_first_not_of(_delims); |
| 138 | while (start != _source.npos) |
| 139 | { |
| 140 | size_t end = _source.find_first_of(_delims, start); |
| 141 | if (end != _source.npos) |
| 142 | _ret.emplace_back(_source.substr(start, end - start)); |
| 143 | else |
| 144 | { |
| 145 | _ret.emplace_back(_source.substr(start)); |
| 146 | break; |
| 147 | } |
| 148 | start = _source.find_first_not_of(_delims, end + 1); |
| 149 | } |
| 150 | } |
| 151 | } // namespace templates |
| 152 | |
| 153 | inline std::vector<std::string> split(std::string_view _source, std::string_view _delims = "\t\n ") |
no test coverage detected