The OpenD Programming Language

leftJustifier

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.

leftJustifier
(
Range
)
(
Range r
,
size_t width
,
dchar fillChar = ' '
)

Parameters

r Range

string or range of characters

width size_t

minimum field width

fillChar dchar

used to pad end up to width characters

Return Value

Type: auto

a lazy range of the left justified result

Examples

import std.algorithm.comparison : equal;
import std.utf : byChar;
assert(leftJustifier("hello", 2).equal("hello".byChar));
assert(leftJustifier("hello", 7).equal("hello  ".byChar));
assert(leftJustifier("hello", 7, 'x').equal("helloxx".byChar));

See Also

Meta