MCPcopy Create free account
hub / github.com/catchorg/Catch2 / splitStringRef

Function splitStringRef

src/catch2/internal/catch_string_manip.cpp:94–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92 }
93
94 std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) {
95 std::vector<StringRef> subStrings;
96 std::size_t start = 0;
97 for(std::size_t pos = 0; pos < str.size(); ++pos ) {
98 if( str[pos] == delimiter ) {
99 if( pos - start > 1 )
100 subStrings.push_back( str.substr( start, pos-start ) );
101 start = pos+1;
102 }
103 }
104 if( start < str.size() )
105 subStrings.push_back( str.substr( start, str.size()-start ) );
106 return subStrings;
107 }
108
109 std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {
110 os << pluraliser.m_count << ' ' << pluraliser.m_label;

Callers 1

parseEnumsFunction · 0.70

Calls 2

sizeMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected