MCPcopy Create free account
hub / github.com/Xtra-Computing/thundersvm / replaceFirstWithEscape

Method replaceFirstWithEscape

src/thundersvm/util/log.cpp:848–860  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

846 }
847
848 void Str::replaceFirstWithEscape(base::type::string_t& str, const base::type::string_t& replaceWhat,
849 const base::type::string_t& replaceWith) {
850 std::size_t foundAt = base::type::string_t::npos;
851 while ((foundAt = str.find(replaceWhat, foundAt + 1)) != base::type::string_t::npos) {
852 if (foundAt > 0 && str[foundAt - 1] == base::consts::kFormatSpecifierChar) {
853 str.erase(foundAt > 0 ? foundAt - 1 : 0, 1);
854 ++foundAt;
855 } else {
856 str.replace(foundAt, replaceWhat.length(), replaceWith);
857 return;
858 }
859 }
860 }
861#if defined(ELPP_UNICODE)
862 void Str::replaceFirstWithEscape(base::type::string_t& str, const base::type::string_t& replaceWhat,
863 const std::string& replaceWith) {

Callers

nothing calls this directly

Calls 2

endMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected