MCPcopy Create free account
hub / github.com/Snapchat/Valdi / split

Function split

tsn/main/main.cpp:11–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9using namespace Valdi;
10
11std::vector<std::string> split(const std::string& s, char delimiter) {
12 std::vector<std::string> tokens;
13 std::string token;
14 for (char ch : s) {
15 if (ch == delimiter) {
16 if (!token.empty()) {
17 tokens.push_back(token);
18 token.clear();
19 }
20 } else {
21 token += ch;
22 }
23 }
24 // Add the last token
25 if (!token.empty()) {
26 tokens.push_back(token);
27 }
28 return tokens;
29}
30
31int main(int argc, const char** argv) {
32 if (argc <= 1) {

Callers 5

splitMethod · 0.85
pickAttach.test.tsFile · 0.85
constructorMethod · 0.85
mainFunction · 0.85

Calls 2

clearMethod · 0.65
emptyMethod · 0.45

Tested by

no test coverage detected