MCPcopy Create free account
hub / github.com/EQEmu/EQEmu / Split

Method Split

common/strings.cpp:79–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79std::vector<std::string> Strings::Split(const std::string &str, const char delim)
80{
81 std::vector<std::string> ret;
82 std::string::size_type start = 0;
83 auto end = str.find(delim);
84 while (end != std::string::npos) {
85 ret.emplace_back(str, start, end - start);
86 start = end + 1;
87 end = str.find(delim, start);
88 }
89 // this will catch the last word since the string is unlikely to end with a delimiter
90 if (str.length() > start) {
91 ret.emplace_back(str, start, str.length() - start);
92 }
93 return ret;
94}
95
96// this one takes delimiter length into consideration
97std::vector<std::string> Strings::Split(const std::string &s, const std::string &delimiter)

Callers 4

mainFunction · 0.80
mainFunction · 0.80
loadDefinitionsFunction · 0.80
readFileFunction · 0.80

Calls 3

push_backMethod · 0.80
findMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected