The OpenD Programming Language

rightJustify

Right justify s in a field width characters wide. fillChar is the character that will be used to fill up the space in the field that s doesn't fill.

S
rightJustify
(
S
)
(
S s
,
size_t width
,
dchar fillChar = ' '
)

Parameters

s S

string

width size_t

minimum field width

fillChar dchar

used to pad end up to width characters

Return Value

Type: S

GC allocated string

Examples

assert(rightJustify("hello", 7, 'X') == "XXhello");
assert(rightJustify("hello", 2, 'X') == "hello");
assert(rightJustify("hello", 9, 'X') == "XXXXhello");

See Also

rightJustifier, which does not allocate

Meta