MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / split

Method split

Sources/Shared/Containers/StringView.cpp:41–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39 template<> template<> BasicStringView<const char>::BasicStringView(const String& string) noexcept : BasicStringView{string.data(), string.size(), string.viewFlags()} {}
40
41 template<class T> Array<BasicStringView<T>> BasicStringView<T>::split(const char delimiter) const {
42 Array<BasicStringView<T>> parts;
43 T* const end = this->end();
44 T* oldpos = _data;
45 T* pos;
46 while (oldpos < end && (pos = static_cast<T*>(std::memchr(oldpos, delimiter, end - oldpos)))) {
47 arrayAppend(parts, slice(oldpos, pos));
48 oldpos = pos + 1;
49 }
50
51 if (!empty())
52 arrayAppend(parts, suffix(oldpos));
53
54 return parts;
55 }
56
57 template<class T> Array<BasicStringView<T>> BasicStringView<T>::splitWithoutEmptyParts(const char delimiter) const {
58 Array<BasicStringView<T>> parts;

Callers

nothing calls this directly

Calls 9

endMethod · 0.95
arrayAppendFunction · 0.85
sliceFunction · 0.85
suffixFunction · 0.85
DEATH_ASSERTFunction · 0.85
stringFindStringFunction · 0.85
emptyFunction · 0.70
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected