MCPcopy Create free account
hub / github.com/arun11299/cpp-subprocess / split

Function split

test/test_split.cc:5–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#include <vector>
4
5std::vector<std::string>
6split(const std::string& str, const std::string& delims=" \t")
7{
8 std::vector<std::string> res;
9 size_t init = 0;
10
11 while (true) {
12 auto pos = str.find_first_of(delims, init);
13 if (pos == std::string::npos) {
14 res.emplace_back(str.substr(init, str.length()));
15 break;
16 }
17 res.emplace_back(str.substr(init, pos - init));
18 pos++;
19 init = pos;
20 }
21
22 return res;
23}
24
25std::string join(const std::vector<std::string>& vec)
26{

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected