summaryrefslogtreecommitdiff
path: root/tools.cpp
diff options
context:
space:
mode:
authorThomas Keil <tkeil (at) datacrystal (dot) de>2007-05-01 13:44:09 +0000
committerThomas Keil <tkeil (at) datacrystal (dot) de>2007-05-01 13:44:09 +0000
commita7353164a339d29e3534b5534171175ee679a360 (patch)
treede93dfcee3cc56468c4d7834a4b26d4529c5b6eb /tools.cpp
parentb3a350b379c46e4c8b56415fadf07fb7c9749621 (diff)
downloadvdr-plugin-live-a7353164a339d29e3534b5534171175ee679a360.tar.gz
vdr-plugin-live-a7353164a339d29e3534b5534171175ee679a360.tar.bz2
Added function ZeroPad to pad numbers with leading zeroes, e.g. 5 -> 05
Diffstat (limited to 'tools.cpp')
-rw-r--r--tools.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools.cpp b/tools.cpp
index fff3483..8959317 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -1,4 +1,5 @@
#include <stdexcept>
+#include <iomanip>
#include <tnt/ecpp.h>
#include <tnt/htmlescostream.h>
#include <tnt/httprequest.h>
@@ -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