diff --git a/src/lib/base/String.cpp b/src/lib/base/String.cpp index 5f490959a..93908e0f1 100644 --- a/src/lib/base/String.cpp +++ b/src/lib/base/String.cpp @@ -147,15 +147,6 @@ std::string sprintf(const char *fmt, ...) return result; } -void findReplaceAll(std::string &subject, const std::string &find, const std::string &replace) -{ - size_t pos = 0; - while ((pos = subject.find(find, pos)) != std::string::npos) { - subject.replace(pos, find.length(), replace); - pos += replace.length(); - } -} - std::string toHex(const std::string &subject, int width, const char fill) { std::stringstream ss; diff --git a/src/lib/base/String.h b/src/lib/base/String.h index 431108812..071d6980f 100644 --- a/src/lib/base/String.h +++ b/src/lib/base/String.h @@ -46,12 +46,6 @@ Equivalent to sprintf() except the result is returned as a String. */ std::string sprintf(const char *fmt, ...); -//! Find and replace all -/*! -Finds \c find inside \c subject and replaces it with \c replace -*/ -void findReplaceAll(std::string &subject, const std::string &find, const std::string &replace); - //! Convert into hexdecimal /*! Convert each character in \c subject into hexdecimal form with \c width diff --git a/src/test/unittests/base/StringTests.cpp b/src/test/unittests/base/StringTests.cpp index 3d1dc34b2..0d55de323 100644 --- a/src/test/unittests/base/StringTests.cpp +++ b/src/test/unittests/base/StringTests.cpp @@ -22,17 +22,6 @@ TEST(StringTests, format_formatWithArguments_formatedString) EXPECT_EQ("%answer=42", result); } -TEST(StringTests, findReplaceAll_inputString_replacedString) -{ - std::string subject = "foobar"; - std::string find = "bar"; - std::string replace = "baz"; - - string::findReplaceAll(subject, find, replace); - - EXPECT_EQ("foobaz", subject); -} - TEST(StringTests, sprintf_formatWithArgument_formatedString) { const char *format = "%s=%d";