User Guide
Chapter 2: ColdFusion Functions 471
NumberFormat
Creates a custom-formatted number value. If no mask is specified, returns the value as
an integer with a thousands separator.
See also DecimalFormat, DollarFormat, and IsNumeric.
Syntax NumberFormat(
number
[,
mask
])
number
The number you want to format.
mask
Set of characters that are used to show how ColdFusion should display the
number.
Mask characters
Character Meaning
_ (underscore)
Optional digit placeholder.
9
Optional digit placeholder. Same as _, but shows decimal places
more clearly.
.
Specifies the location of a mandatory decimal point.
0
Located to the left or right of a mandatory decimal point, to
force padding with zeros.
( )
Places parentheses around the mask if the number is less than 0.
+
Places + in front of positive numbers, - (minus sign) in front of
negative numbers.
-
Place " " (space) in front of positive, - (minus sign) in front of
negative numbers.
,
Separates thousands with commas.
L,C
Specifies left-justify or center-justify a number within the width
of the mask column. L or C must appear as the first character of
the mask. By default, numbers are right-justified.
$
Places a dollar sign in front of the formatted number. $ must
appear as the first character of the mask.
^
Separates left from right formatting.