summaryrefslogtreecommitdiff
path: root/pagelib
diff options
context:
space:
mode:
Diffstat (limited to 'pagelib')
-rw-r--r--pagelib/tools.cpp11
-rw-r--r--pagelib/tools.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/pagelib/tools.cpp b/pagelib/tools.cpp
index aeaba36..e1d9a03 100644
--- a/pagelib/tools.cpp
+++ b/pagelib/tools.cpp
@@ -26,4 +26,15 @@ string FormatDateTime( char const* format, time_t time )
return result;
}
+string StringReplace( string const& text, string const& substring, string const& replacement )
+{
+ string result = text;
+ string::size_type pos = 0;
+ while ( ( pos = result.find( substring, pos ) ) != string::npos ) {
+ result.replace( pos, substring.length(), replacement );
+ pos += replacement.length();
+ }
+ return result;
+}
+
}
diff --git a/pagelib/tools.h b/pagelib/tools.h
index f9eb33a..c39075b 100644
--- a/pagelib/tools.h
+++ b/pagelib/tools.h
@@ -8,6 +8,7 @@
namespace vdrlive {
std::string FormatDateTime( char const* format, time_t time );
+std::string StringReplace( std::string const& text, std::string const& substring, std::string const& replacement );
class ReadLock
{