summaryrefslogtreecommitdiff
path: root/src/util/string.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2014-12-11 17:58:50 -0500
committerShadowNinja <shadowninja@minetest.net>2015-01-03 14:50:16 -0500
commit3c3887bb198c07b50ad3451f228aadfe6fd25168 (patch)
treefec7a00f1e64b9d2fc269d41cef42940c155c62a /src/util/string.cpp
parentd91559b8f08a8e1957f673307b777da176c31b5a (diff)
downloadminetest-3c3887bb198c07b50ad3451f228aadfe6fd25168.tar.gz
minetest-3c3887bb198c07b50ad3451f228aadfe6fd25168.tar.bz2
minetest-3c3887bb198c07b50ad3451f228aadfe6fd25168.zip
Deduplicate code and use stdlib in string functions
Diffstat (limited to 'src/util/string.cpp')
-rw-r--r--src/util/string.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/util/string.cpp b/src/util/string.cpp
index c590e7e57..1d9560608 100644
--- a/src/util/string.cpp
+++ b/src/util/string.cpp
@@ -22,15 +22,16 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "numeric.h"
#include "log.h"
-#include <sstream>
-#include <iomanip>
-#include <map>
-
#include "../sha1.h"
#include "../base64.h"
#include "../hex.h"
#include "../porting.h"
+#include <algorithm>
+#include <sstream>
+#include <iomanip>
+#include <map>
+
static bool parseHexColorString(const std::string &value, video::SColor &color);
static bool parseNamedColorString(const std::string &value, video::SColor &color);
@@ -577,3 +578,9 @@ static bool parseNamedColorString(const std::string &value, video::SColor &color
return true;
}
+
+void str_replace(std::string &str, char from, char to)
+{
+ std::replace(str.begin(), str.end(), from, to);
+}
+