decimalFormat

Converts a number to a decimal-formatted string.

decimalFormat(number) → returns string

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>");

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub