MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / split_by_char

Function split_by_char

libCacheSim/bin/mrcProfiler/cli_parser.cpp:164–181  ·  view source on GitHub ↗

* @brief split string by char * * @param input * @param c */

Source from the content-addressed store, hash-verified

162 * @param c
163 */
164std::vector<std::string> split_by_char(const char *input, const char &c) {
165 std::vector<std::string> result;
166 if (!input) return result; // if input is null, return empty vector
167
168 const char *start = input;
169 const char *current = input;
170
171 while (*current) {
172 if (*current == c) {
173 result.emplace_back(start, current - start);
174 start = current + 1;
175 }
176 ++current;
177 }
178
179 if (current != start) result.emplace_back(start, current - start);
180 return result;
181}
182
183/**
184 *

Callers 1

parse_mrc_size_paramsFunction · 0.85

Calls 1

emplace_backMethod · 0.45

Tested by

no test coverage detected