You need to format a number as a US currency for output.

The dollarFormat() function takes a number as its single parameter, and returns a formatted String. The following formatting is added to the string: two decimal places, thousandths separator, and a dollar sign. Furthermore, if the number is negative, it will be wrapped in parentheses.

<cfset testNum = -537>
<cfoutput>#dollarFormat(testNum)#</cfoutput>
($537.00)

This question was written by Jeremy Petersen
It was last updated on January 9, 2006.

Categories

Numbers

Comments

comments powered by Disqus