diff options
-rw-r--r-- | tools.cpp | 9 | ||||
-rw-r--r-- | tools.h | 1 |
2 files changed, 10 insertions, 0 deletions
@@ -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 @@ -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 { |