summaryrefslogtreecommitdiff
path: root/pagelib/tools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pagelib/tools.cpp')
-rw-r--r--pagelib/tools.cpp11
1 files changed, 11 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;
+}
+
}