MCPcopy Create free account
hub / github.com/apache/impala / SplitStringToIteratorAllowEmpty

Function SplitStringToIteratorAllowEmpty

be/src/gutil/strings/split.cc:288–306  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286// ----------------------------------------------------------------------
287template <typename StringType, typename ITR>
288static inline
289void SplitStringToIteratorAllowEmpty(const StringType& full,
290 const char* delim,
291 int pieces,
292 ITR& result) {
293 string::size_type begin_index, end_index;
294 begin_index = 0;
295
296 for (int i = 0; (i < pieces-1) || (pieces == 0); i++) {
297 end_index = full.find_first_of(delim, begin_index);
298 if (end_index == string::npos) {
299 *result++ = full.substr(begin_index);
300 return;
301 }
302 *result++ = full.substr(begin_index, (end_index - begin_index));
303 begin_index = end_index + 1;
304 }
305 *result++ = full.substr(begin_index);
306}
307
308void SplitStringIntoNPiecesAllowEmpty(const string& full,
309 const char* delim,

Callers

nothing calls this directly

Calls 2

substrMethod · 0.80
find_first_ofMethod · 0.45

Tested by

no test coverage detected