MCPcopy Create free account
hub / github.com/axmolengine/axmol / split

Function split

core/base/NS.cpp:42–56  ·  view source on GitHub ↗

string toolkit

Source from the content-addressed store, hash-verified

40
41// string toolkit
42static inline void split(std::string_view src, std::string_view token, strArray& vect)
43{
44 size_t nend = 0;
45 size_t nbegin = 0;
46 size_t tokenSize = token.size();
47 while (nend != std::string::npos)
48 {
49 nend = src.find(token, nbegin);
50 if (nend == std::string::npos)
51 vect.emplace_back(std::string{src.substr(nbegin, src.length() - nbegin)});
52 else
53 vect.emplace_back(std::string{src.substr(nbegin, nend - nbegin)});
54 nbegin = nend + tokenSize;
55 }
56}
57
58// first, judge whether the form of the string like this: {x,y}
59// if the form is right,the string will be split into the parameter strs;

Callers 6

splitWithFormFunction · 0.70
splitMethod · 0.70
parseCommandMethod · 0.70
performCommandMethod · 0.70

Calls 5

sizeMethod · 0.45
findMethod · 0.45
emplace_backMethod · 0.45
substrMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected