MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / str_replace

Function str_replace

Source/Utils/StringUtil.cpp:33–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31}
32
33void str_replace(std::string& s, const std::string_view from, const std::string_view to)
34{
35 std::string str;
36 size_t pos = 0;
37 size_t pf = 0;
38 while ((pf = s.find(from, pos)) < s.size()) {
39 str.append(s, pos, pf - pos);
40 str.append(to);
41 pos = pf + from.size();
42 }
43 if (str.size()) {
44 str.append(s, pos);
45 s = str;
46 }
47}
48
49void str_replace(std::wstring& s, const std::wstring_view from, const std::wstring_view to)
50{

Callers 1

OnActivateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected