toPaddedString
1.5.1
toPaddedString(length[, radix]) -> String
Converts the number into a string padded with 0
s so that the string’s length is at least equal to length
. Takes an optional radix
argument which specifies the base to use for conversion.
Examples
(13).toPaddedString(4);
// -> '0013'
(13).toPaddedString(2);
// -> '13'
(13).toPaddedString(1);
// -> '13'
(13).toPaddedString(4, 16)
// -> '000d'
(13).toPaddedString(4, 2);
// -> '1101'