Version: v0.8.1 - Beta.  We welcome contributors & feedback.

Number.zeroPadRight

zeroPadRight($numDecimalDigits) -> string

Description

Append zeros to the right of a number to reach $numDecimalDigits in length.

This function only counts digits to the right of the decimal point.

If $numDecimalDigits is less than the current precision, the decimal digits will be rounded.

Returns a string.

$num = 123
$num.zeroPadRight(2)  //= '123.00'

$num = 123.456
$num.zeroPadRight(5)  //= '123.45600'
$num.zeroPadRight(1)  //= '123.5'

See Also