Contents > CFML Reference > ColdFusion Functions > DollarFormat PreviousNext

DollarFormat

Formats a string in U.S. format. (For other currencies, use LSCurrencyFormat or LSEuroCurrencyFormat.)

A number as a string, formatted with two decimal places, thousands separator, and dollar sign. If number is negative, the return value is enclosed in parentheses. If number is an empty string, returns zero.

Display and formatting functions

DollarFormat(number)

DecimalFormat, NumberFormat

Parameter

Description

number

Number to format

<!--- This example shows the use of DollarFormat --->
<html>
<head>
<title>DollarFormat Example</title>
</head>
<body>
<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> 

Contents > CFML Reference > ColdFusion Functions > DollarFormat PreviousNext

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

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functi73.htm