mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Helper Functions
- Implemented rightJustifyZero for zero-padded integer strings.
This commit is contained in:
parent
589627852f
commit
013061803f
2 changed files with 9 additions and 0 deletions
|
@ -951,6 +951,14 @@ std::string leftJustify (const std::string& input, const int width)
|
||||||
return input + std::string (width - utf8_text_length (input), ' ');
|
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)
|
std::string rightJustify (const int input, const int width)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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 int, const int);
|
||||||
std::string leftJustify (const std::string&, 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 int, const int);
|
||||||
std::string rightJustify (const std::string&, const int);
|
std::string rightJustify (const std::string&, const int);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue