summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools.cpp10
-rw-r--r--tools.h1
2 files changed, 11 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
diff --git a/tools.h b/tools.h
index 0779e8f..817e6f3 100644
--- a/tools.h
+++ b/tools.h
@@ -30,6 +30,7 @@ std::string StringWordTruncate(const std::string& input, size_t maxLen, bool& tr
std::string StringEscapeAndBreak( std::string const& input );
std::string StringFormatBreak(std::string const& input);
std::string StringTrim(const std::string& str);
+std::string ZeroPad(int number);
struct bad_lexical_cast: std::runtime_error
{