From 9b0557c2c31dbc95b040ac79b17804f6da6c5dcb Mon Sep 17 00:00:00 2001 From: Dieter Hametner Date: Sun, 7 Jan 2007 23:25:01 +0000 Subject: added StringRepeat function to tools --- tools.cpp | 9 +++++++++ tools.h | 1 + 2 files changed, 10 insertions(+) diff --git a/tools.cpp b/tools.cpp index 515418a..de0b43c 100644 --- a/tools.cpp +++ b/tools.cpp @@ -62,4 +62,13 @@ int StringToInt( std::string const& string, int base ) return 0; } +string StringRepeat(int times, const string& input) +{ + string result; + for (int i = 0; i < times; i++) { + result += input; + } + return result; +} + } // namespace vdrlive diff --git a/tools.h b/tools.h index 7db052e..d830d47 100644 --- a/tools.h +++ b/tools.h @@ -14,6 +14,7 @@ std::string FormatDateTime( char const* format, time_t time ); std::string StringReplace( std::string const& text, std::string const& substring, std::string const& replacement ); std::vector< std::string > StringSplit( std::string const& text, char delimiter ); int StringToInt( std::string const& string, int base = 10 ); +std::string StringRepeat(int times, const std::string& input); struct bad_lexical_cast: std::runtime_error { -- cgit v1.2.3