MCPcopy Create free account
hub / github.com/baidu/tera / SplitString

Function SplitString

src/common/base/string_ext.cc:7–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5#include "common/base/string_ext.h"
6
7void SplitString(const std::string& full, const std::string& delim,
8 std::vector<std::string>* result) {
9 result->clear();
10 if (full.empty()) {
11 return;
12 }
13
14 std::string tmp;
15 std::string::size_type pos_begin = full.find_first_not_of(delim);
16 std::string::size_type comma_pos = 0;
17
18 while (pos_begin != std::string::npos) {
19 comma_pos = full.find(delim, pos_begin);
20 if (comma_pos != std::string::npos) {
21 tmp = full.substr(pos_begin, comma_pos - pos_begin);
22 pos_begin = comma_pos + delim.length();
23 } else {
24 tmp = full.substr(pos_begin);
25 pos_begin = comma_pos;
26 }
27
28 if (!tmp.empty()) {
29 result->push_back(tmp);
30 tmp.clear();
31 }
32 }
33}
34
35void SplitStringEnd(const std::string& full, std::string* begin_part, std::string* end_part,
36 std::string delim) {

Callers 15

GetMapFromNexusFunction · 0.50
GetTabletIdForDiffFunction · 0.50
GetTabletIdForDumpFunction · 0.50
ScanAndDumpDataFunction · 0.50
LoadTablesMapFileFunction · 0.50
MayBeAddCfMapByLgMapFunction · 0.50
MayBeChangeSchemaByLgMapFunction · 0.50
GetTablesCfVersionMapFunction · 0.50
ScanAndDiffDataFunction · 0.50
ScanDestFunction · 0.50
StatDiffResultFunction · 0.50
InitMethod · 0.50

Calls 3

push_backMethod · 0.80
clearMethod · 0.45
emptyMethod · 0.45

Tested by 5

InitMethod · 0.40
RunTestMethod · 0.40
ParseOpMethod · 0.40
LoadTxnConfMethod · 0.40
TEST_FFunction · 0.40