lpad

fun Int.lpad(width: Int, padChar: Char = '0'): String

Left-pads this Int to the specified width with padChar.

Extension function on Int. When padding a negative number with '0', the zeros go after the minus sign, as with "%0Nd": (-1).lpad(4) is "-001". Any other padChar goes before the sign: " -1".

Return

the left-padded string

Parameters

width

the minimum width of the resulting string

padChar

the character to pad with (default '0')