The numeric value to format.
Configuration object.
Optionaldecimals?: numberDefault 0. Number of decimal places to include.
OptionaldecimalSeparator?: stringDefault '.'. Character to use as the decimal separator.
OptionalsignificativeNumber?: booleanDefault false. If true, trailing zeros in the decimal part will be omitted.
OptionalthousandSeparator?: stringDefault ','. Character to use as the thousand separator.
A formatted string representing the number.
console.log(PUtilsNumber.format(123456789.1234)) // 123,456,789
console.log(PUtilsNumber.format(123456789.1234, { decimals: 2 })) // 123,456,789.12
console.log(PUtilsNumber.format(123456789.1234, { decimals: 5 })) // 123,456,789.12340
console.log(PUtilsNumber.format(123456789.1234, { decimals: 5, significativeNumber: true })) // 123,456,789.1234
console.log(PUtilsNumber.format(123456789.1234, { decimals: 5, significativeNumber: true, decimalSeparator: ',', millarSeparator: ' ' })) // 123 456 789,1234
Converts a number to a formatted string representation.