User Guide
Chapter 2: ColdFusion Functions 341
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 = Evaluate(counter + (1/4))>
<CFSET half = Evaluate(counter + (1/2))>
<CFSET threefourth = Evaluate(counter + (3/4))>
<CFOUTPUT>
<PRE>
bill#DollarFormat(full)##DollarFormat(quarter)#
#DollarFormat(half)# #DollarFormat(threefourth)#
18% tip#DollarFormat(Evaluate(full * (18/100)))#
#DollarFormat(Evaluate(quarter * (18/100)))#
#DollarFormat(Evaluate(half * (18/100)))#
#DollarFormat(Evaluate(threefourth * (18/100)))#
</PRE>
</CFOUTPUT>
</CFLOOP>
</BODY>
</HTML>