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

Function splitStringRef

extras/catch_amalgamated.cpp:7015–7028  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7013 }
7014
7015 std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) {
7016 std::vector<StringRef> subStrings;
7017 std::size_t start = 0;
7018 for(std::size_t pos = 0; pos < str.size(); ++pos ) {
7019 if( str[pos] == delimiter ) {
7020 if( pos - start > 1 )
7021 subStrings.push_back( str.substr( start, pos-start ) );
7022 start = pos+1;
7023 }
7024 }
7025 if( start < str.size() )
7026 subStrings.push_back( str.substr( start, str.size()-start ) );
7027 return subStrings;
7028 }
7029
7030 std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {
7031 os << pluraliser.m_count << ' ' << pluraliser.m_label;

Callers 2

parseEnumsFunction · 0.70

Calls 2

sizeMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected