MCPcopy Create free account
hub / github.com/devsisters/libquic / SplitStringUsingSubstrT

Function SplitStringUsingSubstrT

src/base/strings/string_split.cc:134–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

132
133template <typename Str, typename OutputStringType>
134void SplitStringUsingSubstrT(BasicStringPiece<Str> input,
135 BasicStringPiece<Str> delimiter,
136 WhitespaceHandling whitespace,
137 SplitResult result_type,
138 std::vector<OutputStringType>* result) {
139 using Piece = BasicStringPiece<Str>;
140 using size_type = typename Piece::size_type;
141
142 result->clear();
143 for (size_type begin_index = 0, end_index = 0; end_index != Piece::npos;
144 begin_index = end_index + delimiter.size()) {
145 end_index = input.find(delimiter, begin_index);
146 Piece term = end_index == Piece::npos
147 ? input.substr(begin_index)
148 : input.substr(begin_index, end_index - begin_index);
149
150 if (whitespace == TRIM_WHITESPACE)
151 term = TrimString(term, WhitespaceForType<Str>(), TRIM_ALL);
152
153 if (result_type == SPLIT_WANT_ALL || !term.empty())
154 result->push_back(PieceToOutputType<Str, OutputStringType>(term));
155 }
156}
157
158} // namespace
159

Callers 2

SplitStringUsingSubstrFunction · 0.85

Calls 7

TrimStringFunction · 0.85
substrMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected