MCPcopy Create free account
hub / github.com/ARM-software/armnn / SplitBy

Function SplitBy

src/armnnUtils/ModelAccuracyChecker.cpp:40–62  ·  view source on GitHub ↗

Split a string into tokens by a delimiter

Source from the content-addressed store, hash-verified

38
39// Split a string into tokens by a delimiter
40std::vector<std::string>
41 SplitBy(const std::string& originalString, const std::string& delimiter, bool includeEmptyToken)
42{
43 std::vector<std::string> tokens;
44 size_t cur = 0;
45 size_t next = 0;
46 while ((next = originalString.find(delimiter, cur)) != std::string::npos)
47 {
48 // Skip empty tokens, unless explicitly stated to include them.
49 if (next - cur > 0 || includeEmptyToken)
50 {
51 tokens.push_back(originalString.substr(cur, next - cur));
52 }
53 cur = next + delimiter.size();
54 }
55 // Get the remaining token
56 // Skip empty tokens, unless explicitly stated to include them.
57 if (originalString.size() - cur > 0 || includeEmptyToken)
58 {
59 tokens.push_back(originalString.substr(cur, originalString.size() - cur));
60 }
61 return tokens;
62}
63
64// Remove any preceding and trailing character specified in the characterSet.
65std::string Strip(const std::string& originalString, const std::string& characterSet)

Callers 2

mainFunction · 0.85
LoadModelOutputLabelsFunction · 0.85

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected