DollarFormat

Returns number as a string formatted with two decimal places, thousands separator, dollar sign. Parentheses are used if number is negative.

See also DecimalFormat and NumberFormat.

Syntax

DollarFormat(number)
number

Number being formatted.

Examples

<!--- This example shows the use of DollarFormat --->
<HTML>
<HEAD>
<TITLE>
DollarFormat Example
</TITLE>
</HEAD>

<BODY bgcolor=silver>
<H3>DollarFormat Example</H3>

<CFLOOP from=8 to=50 index=counter>
<CFSET full=counter>
<CFSET quarter=counter + (1/4)>
<CFSET half=counter + (1/2)>
<CFSET threefourth=counter + (3/4)>
<CFOUTPUT>
<PRE>
bill    #DollarFormat(full)#    #DollarFormat(quarter)#
  #DollarFormat(half)#  #DollarFormat(threefourth)#
18% tip    #DollarFormat(full * (18/100))#
  #DollarFormat(quarter * (18/100))#
  #DollarFormat(half * (18/100))#
  #DollarFormat(threefourth * (18/100))#
</PRE>
</CFOUTPUT>
</CFLOOP>

</BODY>
</HTML>