File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed
Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -591,7 +591,7 @@ namespace pcs // i.e. "pythonic c++ strings"
591591 if (this ->size () >= width)
592592 return *this ;
593593 else
594- return CppStringT (width - this ->size (), fillch) + * this ;
594+ return * this + CppStringT (width - this ->size (), fillch);
595595 }
596596
597597
@@ -850,6 +850,22 @@ namespace pcs // i.e. "pythonic c++ strings"
850850 }
851851
852852
853+ // --- rjust() -----------------------------------------
854+ /* * \brief Returns the string right justified in a string of length width.
855+ *
856+ * Padding is done using the specified fillchar (default is an ASCII space).
857+ * The original string is returned if width is less than or equal to len(s).
858+ */
859+ inline CppStringT rjust (const size_type width, const value_type fillch = value_type(' ' )) const noexcept
860+ {
861+ if (this ->size () >= width)
862+ return *this ;
863+ else
864+ return CppStringT (width - this ->size (), fillch) + *this ;
865+ }
866+
867+
868+
853869 // --- title() -----------------------------------------
854870 /* * \brief Returns a titlecased copy of the string where words start with an uppercase character and the remaining characters are lowercase. */
855871 inline CppStringT title () const noexcept
You can’t perform that action at this time.
0 commit comments