From d099e98dae6674e7689cbe72a93a82b95c2985e5 Mon Sep 17 00:00:00 2001 From: kervala Date: Sun, 5 Nov 2017 19:06:03 +0100 Subject: [PATCH] Changed: Moved strFindReplaceAll to algo.h --HG-- branch : develop --- code/nel/include/nel/misc/algo.h | 8 ++++++++ code/nel/src/gui/lua_ihm.cpp | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/code/nel/include/nel/misc/algo.h b/code/nel/include/nel/misc/algo.h index 72d9ae3ae..50493538f 100644 --- a/code/nel/include/nel/misc/algo.h +++ b/code/nel/include/nel/misc/algo.h @@ -211,6 +211,14 @@ bool strFindReplace(T &str, const char *strFind, const U &strReplace) return strFindReplace(str, tempStr, strReplace); } +template +T strFindReplaceAll(const T &str, const T &search, const T &replace) +{ + T ret = str; + while (strFindReplace(ret, search, replace)); + return ret; +} + // set flags in a bit set template inline void setFlags(T &dest, U mask, bool on) diff --git a/code/nel/src/gui/lua_ihm.cpp b/code/nel/src/gui/lua_ihm.cpp index fed1340a0..0b4a1d0dc 100644 --- a/code/nel/src/gui/lua_ihm.cpp +++ b/code/nel/src/gui/lua_ihm.cpp @@ -1817,9 +1817,7 @@ namespace NLGUI ucstring CLuaIHM::findReplaceAll(const ucstring &str, const ucstring &search, const ucstring &replace) { //H_AUTO(Lua_CLuaIHM_findReplaceAll) - ucstring ret= str; - while(strFindReplace(ret, search, replace)); - return ret; + return strFindReplaceAll(str, search, replace); } // ***************************************************************************