diff --git a/src/text.cpp b/src/text.cpp index aab6edc6a..bee2f52d2 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -951,6 +951,14 @@ std::string leftJustify (const std::string& input, const int width) return input + std::string (width - utf8_text_length (input), ' '); } +//////////////////////////////////////////////////////////////////////////////// +std::string rightJustifyZero (const int input, const int width) +{ + std::stringstream s; + s << std::setw (width) << std::setfill ('0') << input; + return s.str (); +} + //////////////////////////////////////////////////////////////////////////////// std::string rightJustify (const int input, const int width) { diff --git a/src/text.h b/src/text.h index bda520f93..8023e6014 100644 --- a/src/text.h +++ b/src/text.h @@ -84,6 +84,7 @@ const std::string format (const std::string&, const std::string&, const std::str std::string leftJustify (const int, const int); std::string leftJustify (const std::string&, const int); +std::string rightJustifyZero (const int, const int); std::string rightJustify (const int, const int); std::string rightJustify (const std::string&, const int);