MCPcopy Create free account
hub / github.com/apache/kvrocks / Split

Function Split

src/common/string_util.cc:65–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63}
64
65std::vector<std::string> Split(std::string_view in, std::string_view delim) {
66 std::vector<std::string> out;
67
68 if (in.empty()) {
69 return out;
70 }
71
72 if (delim.empty()) {
73 out.resize(in.size());
74 std::transform(in.begin(), in.end(), out.begin(), [](char c) -> std::string { return {c}; });
75 return out;
76 }
77
78 size_t begin = 0, end = in.find_first_of(delim);
79 do {
80 std::string_view elem = in.substr(begin, end - begin);
81 if (!elem.empty()) out.emplace_back(elem.begin(), elem.end());
82 if (end == std::string::npos) break;
83 begin = end + 1;
84 end = in.find_first_of(delim, begin);
85 } while (true);
86
87 return out;
88}
89
90std::vector<std::string> Split2KV(const std::string &in, const std::string &delim) {
91 std::vector<std::string> out;

Callers 15

parseConfigFromStringMethod · 0.85
ParseSlotRangesMethod · 0.85
ExecuteMethod · 0.85
ParseCommandFlagsFunction · 0.85
ParseFromJsonMethod · 0.85
ParseFromHashMethod · 0.85
DecodeMethod · 0.85
ExtractFlagsFromShebangFunction · 0.85
InitSpdlogFunction · 0.85
ParseSSLProtocolsFunction · 0.85
ParseMethod · 0.85

Calls 2

beginMethod · 0.80
endMethod · 0.80

Tested by 4

TEST_FFunction · 0.68
TFunction · 0.68
TFunction · 0.68
TESTFunction · 0.68