decimalFormat

Converts a number to a decimal-formatted string.

decimalFormat(number) → returns string

decimalFormat Argument Reference

number numeric
Required

Examples sample code invoking the decimalFormat function

formattedInt = decimalFormat(123); // 123.00
writeOutput(formattedInt & "<br>");

formattedWithSeparators = decimalFormat(1000000); // 1,000,000.00
writeOutput(formattedWithSeparators & "<br>");

formattedDecimal = decimalFormat(987.15); // 987.15
writeOutput(formattedDecimal & "<br>");

formattedRoundedUp = decimalFormat(456.789); // 456.79 - rounds up
writeOutput(formattedRoundedUp & "<br>");

Fork me on GitHub