leftJustify

Left 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
leftJustify
(
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(leftJustify("hello", 7, 'X') == "helloXX");
assert(leftJustify("hello", 2, 'X') == "hello");
assert(leftJustify("hello", 9, 'X') == "helloXXXX");

See Also

leftJustifier, which does not allocate

Meta