diff --git a/src/common/HighScoresManager.cxx b/src/common/HighScoresManager.cxx index 64eb1ed7b..cfaf634a6 100644 --- a/src/common/HighScoresManager.cxx +++ b/src/common/HighScoresManager.cxx @@ -470,18 +470,6 @@ Int32 HighScoresManager::convert(Int32 val, uInt32 maxVal, bool isBCD, bool zero return val; } -#if 0 -void replaceAll(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' - } -} -#endif - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool HighScoresManager::getPropBool(const json& jprops, const string& key, bool defVal) const diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index b0d533d7e..7003a73a4 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -290,6 +290,19 @@ namespace BSPF return false; } + // Modify 'str', replacing all occurrences of 'from' with 'to' + inline void replaceAll(string& str, const string& from, const string& to) + { + if(from.empty()) return; + size_t start_pos = 0; + while((start_pos = str.find(from, start_pos)) != string::npos) + { + str.replace(start_pos, from.length(), to); + start_pos += to.length(); // In case 'to' contains 'from', + // like replacing 'x' with 'yx' + } + } + // C++11 way to get local time // Equivalent to the C-style localtime() function, but is thread-safe inline std::tm localTime()