From 1fa3c1956ff087a5621184e18b0d785e6c41646a Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 19 Feb 2009 01:22:22 -0400 Subject: Moved amount_t::right_justify to simply ::justify --- src/unistring.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/unistring.h') diff --git a/src/unistring.h b/src/unistring.h index 97156fde..b1c46cb3 100644 --- a/src/unistring.h +++ b/src/unistring.h @@ -90,4 +90,22 @@ public: } }; +inline void justify(std::ostream& out, + const std::string& str, + int width, + bool right = false) +{ + if (! right) + out << str; + + unistring temp(str); + + int spacing = width - int(temp.length()); + while (spacing-- > 0) + out << ' '; + + if (right) + out << str; +} + #endif // _UNISTRING_H -- cgit v1.2.3