diff --git a/src/util/string_utils.cpp b/src/util/string_utils.cpp index c926769e314..7e1c2b316e1 100644 --- a/src/util/string_utils.cpp +++ b/src/util/string_utils.cpp @@ -159,28 +159,3 @@ std::string escape(const std::string &s) return result; } - -/// Replace all occurrences of a string inside a string -/// \param [out] str: string to search -/// \param from: string to replace; must be non-empty -/// \param to: string to replace with -/// Copyright notice: -/// Attributed to Gauthier Boaglio -/// Source: https://stackoverflow.com/a/24315631/7501486 -/// Used under MIT license -/// Note that this is quadratic in str.size() if from.size() != to.size(). -/// There is no guarantee that it is linear in str.size() if -/// from.size() == to.size(). -void replace_all( - std::string &str, - const std::string &from, - const std::string &to) -{ - PRECONDITION(!from.empty()); - size_t start_pos = 0; - while((start_pos = str.find(from, start_pos)) != std::string::npos) - { - str.replace(start_pos, from.length(), to); - start_pos += to.length(); - } -} diff --git a/src/util/string_utils.h b/src/util/string_utils.h index 6c0dd5241c3..504c2f3f2b0 100644 --- a/src/util/string_utils.h +++ b/src/util/string_utils.h @@ -96,6 +96,4 @@ join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter) /// programming language. std::string escape(const std::string &); -void replace_all(std::string &, const std::string &, const std::string &); - #endif