
A collection of useful methods to format Numbers.
Formats a number into a formatted string for display to user. It respects localization.
myNumber.format([options]);
false
if the 1.4e+4 should be replaced by 14000(123123123.176).format({ decimal: ".", group: ",", decimals: 2, prefix: "¥", suffix: " (YEN)" }); // returns "¥123.123.123,18 (YEN)" (123456789).format({ precision: 4, scientific: false }); // 123,500,000
Formats a number as currency, with respect to localization.
myNumber.formatCurrency(decimals);
var money = (4125.957).formatCurrency(); // $ 4,125.96
Formats a number as a percentage.
myNumber.formatPercentage(decimals);
var percentage = (4125.957).formatPercentage(); // 4,125.96%
© Linux.ria.ua, 2008-2024 |