DollarFormat

Description

Returns number as a string formatted with two decimal places, thousands separator, and dollar sign. If number is negative, parentheses are used. Returns strings in U.S. format. For other currencies, use LSCurrencyFormat or LSEuroCurrencyFormat.

Category

Display and formatting functions

Syntax

DollarFormat(number) 

See also

DecimalFormat, NumberFormat

Parameters

Parameter
Description
number
Number to format

Example

<!--- 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> 

LiveDocs comments are not longer enabled for ColdFusion 5.0. Please use one of the following resources instead.

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 5.0