dollarFormat

Formats a money string in U.S. currency format.

dollarFormat(number) → returns string

dollarFormat Argument Reference

number numeric
Required

Compatibility

ColdFusion:

DollarFormat Rounding Bug CF-4199995 - Certain inputs do not cause dollarFormat to round up, for example 6.5850 results in $6.58, yet 6.585 results in $6.59. Consider using numberFormat as a workaround. https://tracker.adobe.com/#/view/CF-4199995

Lucee:

This bug mentioned for ACF also existed in Lucee 4.5, but seams to be fixed in Lucee 5. https://luceeserver.atlassian.net/browse/LDEV-574

Examples sample code invoking the dollarFormat function

Dollar Format is about $, commas, and 2 decimal places

dollarFormat(1236598.2)

Expected Result: $1,236,598.20

Negative numbers appear with parentheses.

dollarFormat(-11.34)

Expected Result: ($11.34)


Fork me on GitHub