diff --git a/desktop_version/src/editor.cpp b/desktop_version/src/editor.cpp index 3c5da840..0b9d6376 100644 --- a/desktop_version/src/editor.cpp +++ b/desktop_version/src/editor.cpp @@ -86,6 +86,22 @@ bool compare_nocase (std::string first, std::string second) return false; } +void replace_all(std::string& str, const std::string& from, const std::string& to) +{ + if (from.empty()) + { + return; + } + + 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(); //In case `to` contains `from`, like replacing 'x' with 'yx' + } +} + void editorclass::getDirectoryData() {