diff options
Diffstat (limited to 'src/unistring.h')
-rw-r--r-- | src/unistring.h | 18 |
1 files changed, 18 insertions, 0 deletions
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 |