MCPcopy Create free account
hub / github.com/alibaba/graph-learn / Split

Function Split

graphlearn/src/common/string/string_tool.cc:33–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32template <typename Filter>
33std::vector<std::string> Split(LiteString text, LiteString delims,
34 Filter f) {
35 std::vector<std::string> result;
36 size_t token_start = 0;
37 if (!text.empty()) {
38 for (size_t i = 0; i < text.size() + 1; i++) {
39 if ((i == text.size()) || (delims.find(text[i]) != LiteString::npos)) {
40 LiteString token(text.data() + token_start, i - token_start);
41 if (f(token)) {
42 result.push_back(token.ToString());
43 }
44 token_start = i + 1;
45 }
46 }
47 }
48 return result;
49}
50
51} // anonymous namespace
52

Callers 7

ParseAttributeFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
ParseRecordMethod · 0.85
ParseSchemaMethod · 0.85
ParseRecordMethod · 0.85
GetRecordCountMethod · 0.85

Calls 7

AllowAllClass · 0.85
LiteStringClass · 0.85
findMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
ToStringMethod · 0.45

Tested by 2

mainFunction · 0.68
mainFunction · 0.68