Skip to content

Commit

Permalink
Merge pull request #3782 from burner/std.string.rightJustify_unittest…
Browse files Browse the repository at this point in the history
…_example

std.string.rightJustify_unittest_example
  • Loading branch information
DmitryOlshansky committed Nov 7, 2015
2 parents ce70770 + 434eb12 commit 57facbb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions std/string.d
Original file line number Diff line number Diff line change
Expand Up @@ -3695,6 +3695,14 @@ S rightJustify(S)(S s, size_t width, dchar fillChar = ' ')
return rightJustifier(s, width, fillChar).array;
}

///
@safe pure unittest
{
assert(rightJustify("hello", 7, 'X') == "XXhello");
assert(rightJustify("hello", 2, 'X') == "hello");
assert(rightJustify("hello", 9, 'X') == "XXXXhello");
}

/++
Right justify $(D s) in a field $(D width) characters wide. $(D fillChar)
is the character that will be used to fill up the space in the field that
Expand Down

0 comments on commit 57facbb

Please sign in to comment.