diff options
Diffstat (limited to 'pagelib/tools.cpp')
-rw-r--r-- | pagelib/tools.cpp | 11 |
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; +} + } |