MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / replace_substring

Function replace_substring

dependencies/json/json.hpp:12423–12432  ·  view source on GitHub ↗

! @brief replace all occurrences of a substring by another string @param[in,out] s the string to manipulate; changed so that all occurrences of @a f are replaced with @a t @param[in] f the substring to replace with @a t @param[in] t the string to replace @a f @pre The search string @a f must not be empty. **This precondition is enforced with

Source from the content-addressed store, hash-verified

12421 @since version 2.0.0
12422 */
12423 static void replace_substring(std::string& s, const std::string& f,
12424 const std::string& t)
12425 {
12426 JSON_ASSERT(!f.empty());
12427 for (auto pos = s.find(f); // find first occurrence of f
12428 pos != std::string::npos; // make sure f was found
12429 s.replace(pos, f.size(), t), // replace with t, and
12430 pos = s.find(f, pos + t.size())) // find next occurrence of f
12431 {}
12432 }
12433
12434 JSON_PRIVATE_UNLESS_TESTED:
12435 /// escape "~" to "~0" and "/" to "~1"

Callers 2

json.hppFile · 0.70
unescapeFunction · 0.70

Calls 3

emptyMethod · 0.45
findMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected