From a7353164a339d29e3534b5534171175ee679a360 Mon Sep 17 00:00:00 2001 From: Thomas Keil Date: Tue, 1 May 2007 13:44:09 +0000 Subject: Added function ZeroPad to pad numbers with leading zeroes, e.g. 5 -> 05 --- tools.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tools.cpp') diff --git a/tools.cpp b/tools.cpp index fff3483..8959317 100644 --- a/tools.cpp +++ b/tools.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -8,6 +9,7 @@ #include "setup.h" #include "tools.h" + using namespace std; using namespace tnt; @@ -121,4 +123,12 @@ string StringTrim(string const& str) return res; } +string ZeroPad(int number) +{ + ostringstream os; + os << setw(2) << setfill('0') << number; + return os.str(); +} + + } // namespace vdrlive -- cgit v1.2.3