diff --git a/src/commands/CmdEdit.cpp b/src/commands/CmdEdit.cpp index 6673d190c..32bd0dfce 100644 --- a/src/commands/CmdEdit.cpp +++ b/src/commands/CmdEdit.cpp @@ -172,23 +172,6 @@ std::vector CmdEdit::findValues ( return results; } -//////////////////////////////////////////////////////////////////////////////// -std::string CmdEdit::replaceString ( - std::string text, - const std::string& search, - const std::string& replacement) -{ - std::string::size_type found = 0; - - while ((found = text.find (search, found)) != std::string::npos) - { - text.replace (found, search.length (), replacement); - found += replacement.length (); - } - - return text; -} - //////////////////////////////////////////////////////////////////////////////// std::string CmdEdit::formatDate ( Task& task, @@ -272,7 +255,7 @@ std::string CmdEdit::formatTask (Task task, const std::string& dateformat) { Datetime dt (strtol (anno.first.substr (11).c_str (), nullptr, 10)); before << " Annotation: " << dt.toString (dateformat) - << " -- " << replaceString (anno.second, "\n", ANNOTATION_EDIT_MARKER) << '\n'; + << " -- " << str_replace (anno.second, "\n", ANNOTATION_EDIT_MARKER) << '\n'; } Datetime now; @@ -637,7 +620,7 @@ void CmdEdit::parseTask (Task& task, const std::string& after, const std::string if (eol != std::string::npos) { - auto value = Lexer::trim (replaceString (after.substr (found, eol - found), ANNOTATION_EDIT_MARKER, "\n"), "\t "); + auto value = Lexer::trim (str_replace (after.substr (found, eol - found), ANNOTATION_EDIT_MARKER, "\n"), "\t "); auto gap = value.find (" -- "); if (gap != std::string::npos) { diff --git a/src/commands/CmdEdit.h b/src/commands/CmdEdit.h index 0884a504a..e823e2835 100644 --- a/src/commands/CmdEdit.h +++ b/src/commands/CmdEdit.h @@ -41,7 +41,6 @@ private: std::string findValue (const std::string&, const std::string&); std::string findMultilineValue (const std::string&, const std::string&, const std::string&); std::vector findValues (const std::string&, const std::string&); - std::string replaceString (std::string text, const std::string& search, const std::string& replacement); std::string formatDate (Task&, const std::string&, const std::string&); std::string formatDuration (Task&, const std::string&); std::string formatTask (Task, const std::string&);