| 55 | } |
| 56 | |
| 57 | template<class T> Array<BasicStringView<T>> BasicStringView<T>::splitWithoutEmptyParts(const char delimiter) const { |
| 58 | Array<BasicStringView<T>> parts; |
| 59 | T* const end = this->end(); |
| 60 | T* oldpos = _data; |
| 61 | while (oldpos < end) { |
| 62 | T* pos = static_cast<T*>(std::memchr(oldpos, delimiter, end - oldpos)); |
| 63 | // Not sure why memchr can't just do this, it would make much more sense |
| 64 | if (!pos) pos = end; |
| 65 | |
| 66 | if (pos != oldpos) |
| 67 | arrayAppend(parts, slice(oldpos, pos)); |
| 68 | |
| 69 | oldpos = pos + 1; |
| 70 | } |
| 71 | |
| 72 | return parts; |
| 73 | } |
| 74 | |
| 75 | namespace Implementation |
| 76 | { |
nothing calls this directly
no test coverage detected