MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / replaceInPlace

Function replaceInPlace

Bcore/src/main/cpp/Dobby/tests/catch.hpp:9533–9545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9531}
9532
9533bool replaceInPlace(std::string &str, std::string const &replaceThis, std::string const &withThis) {
9534 bool replaced = false;
9535 std::size_t i = str.find(replaceThis);
9536 while (i != std::string::npos) {
9537 replaced = true;
9538 str = str.substr(0, i) + withThis + str.substr(i + replaceThis.size());
9539 if (i < str.size() - withThis.size())
9540 i = str.find(replaceThis, i + withThis.size());
9541 else
9542 i = std::string::npos;
9543 }
9544 return replaced;
9545}
9546
9547pluralise::pluralise(std::size_t count, std::string const &label) : m_count(count), m_label(label) {
9548}

Callers

nothing calls this directly

Calls 3

findMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected