MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / SplitString

Function SplitString

common/StringUtil.cpp:280–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278 }
279
280 std::vector<std::string_view> SplitString(const std::string_view str, char delimiter, bool skip_empty /*= true*/)
281 {
282 std::vector<std::string_view> res;
283 std::string_view::size_type last_pos = 0;
284 std::string_view::size_type pos;
285 while (last_pos < str.size() && (pos = str.find(delimiter, last_pos)) != std::string_view::npos)
286 {
287 std::string_view part(StripWhitespace(str.substr(last_pos, pos - last_pos)));
288 if (!skip_empty || !part.empty())
289 res.push_back(std::move(part));
290
291 last_pos = pos + 1;
292 }
293
294 if (last_pos < str.size())
295 {
296 std::string_view part(StripWhitespace(str.substr(last_pos)));
297 if (!skip_empty || !part.empty())
298 res.push_back(std::move(part));
299 }
300
301 return res;
302 }
303
304 std::string ReplaceAll(const std::string_view subject, const std::string_view search, const std::string_view replacement)
305 {

Callers 10

ParseCommandLineArgsMethod · 0.50
patchMethod · 0.50
dpatchMethod · 0.50
GetGatewaysMethod · 0.50
GetDNSMethod · 0.50
LoadMacroButtonConfigMethod · 0.50
GetPS2ElfNameFunction · 0.50

Calls 6

StripWhitespaceFunction · 0.85
substrMethod · 0.80
sizeMethod · 0.45
findMethod · 0.45
emptyMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected