aboutsummaryrefslogtreecommitdiff
path: root/lib/base
diff options
context:
space:
mode:
authorghost <andreas.monzner@multimedia-labs.de>2009-02-17 00:35:44 +0100
committerghost <andreas.monzner@multimedia-labs.de>2009-02-17 00:35:44 +0100
commit46108978fb72b40c7feeb52c2a7abbd437f8751d (patch)
tree944b8b4c2e59a27fa6fffacf5bdfa218104e54cb /lib/base
parent3b10e39dace3cda3669de0018bb591ecfadb5ca5 (diff)
downloadenigma2-46108978fb72b40c7feeb52c2a7abbd437f8751d.tar.gz
enigma2-46108978fb72b40c7feeb52c2a7abbd437f8751d.zip
move replace_all function to base/string.h
Diffstat (limited to 'lib/base')
-rw-r--r--lib/base/estring.cpp9
-rw-r--r--lib/base/estring.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/base/estring.cpp b/lib/base/estring.cpp
index 5d15ddce..f1d50ccc 100644
--- a/lib/base/estring.cpp
+++ b/lib/base/estring.cpp
@@ -633,3 +633,12 @@ void makeUpper(std::string &s)
{
std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) toupper);
}
+
+std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol)
+{
+ std::string out = in;
+ std::string::size_type loc = 0;
+ while (( loc = out.find(entity, loc)) != std::string::npos )
+ out.replace(loc, entity.length(), symbol);
+ return out;
+}
diff --git a/lib/base/estring.h b/lib/base/estring.h
index 68e0970f..d61489eb 100644
--- a/lib/base/estring.h
+++ b/lib/base/estring.h
@@ -18,6 +18,7 @@ int isUTF8(const std::string &string);
std::string removeDVBChars(const std::string &s);
void makeUpper(std::string &s);
+std::string replace_all(const std::string &in, const std::string &entity, const std::string &symbol);
inline std::string convertDVBUTF8(const std::string &string, int table=0, int tsidonid=0) // with default ISO8859-1/Latin1
{