padLeft

fnauto padLeft(R, E)(R r, E e, size_t n) if ( ((isInputRange!R && hasLength!R) || isForwardRange!R) && !is(CommonType!(ElementType!R, E) == void) )

Extends the length of the input range r by padding out the start of the range with the element e. The element e must be of a common type with the element type of the range r as defined by CommonType. If n is less than the length of of r, then r is returned unmodified.

If r is a string with Unicode characters in it, padLeft follows D's rules about length for strings, which is not the number of characters, or graphemes, but instead the number of encoding units. If you want to treat each grapheme as only one encoding unit long, then call

byGrapheme before calling this function.

If r has a length, then this is 1. Otherwise, it's r.length.

Parameters

ran input range with a length, or a forward range
eelement to pad the range with
nthe length to pad to

Returns

A range containing the elements of the original range with the extra padding

See Also:

leftJustifier