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

Function Split

src/util/string.h:119–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117 */
118template <typename T = std::span<const char>>
119std::vector<T> Split(const std::span<const char>& sp, std::string_view separators, bool include_sep = false)
120{
121 std::vector<T> ret;
122 auto it = sp.begin();
123 auto start = it;
124 while (it != sp.end()) {
125 if (separators.find(*it) != std::string::npos) {
126 if (include_sep) {
127 ret.emplace_back(start, it + 1);
128 } else {
129 ret.emplace_back(start, it);
130 }
131 start = it + 1;
132 }
133 ++it;
134 }
135 ret.emplace_back(start, it);
136 return ret;
137}
138
139/** Split a string on every instance of sep, returning a vector.
140 *

Callers 9

SplitAllMethod · 0.50
ParseKeyPathFunction · 0.50
ParsePubkeyInnerFunction · 0.50
ParsePubkeyFunction · 0.50
CheckChecksumFunction · 0.50
BOOST_AUTO_TEST_CASEFunction · 0.50
CheckInferDescriptorFunction · 0.50
FUZZ_TARGETFunction · 0.50

Calls 4

findMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
emplace_backMethod · 0.45

Tested by 3

BOOST_AUTO_TEST_CASEFunction · 0.40
CheckInferDescriptorFunction · 0.40
FUZZ_TARGETFunction · 0.40