Whatever message this page gives is out now! Go check it out!
NumberFormat(number [, mask ])| Parameter | Description |
number | A number. |
mask | A string or a variable that contains one. Set of characters that determine how ColdFusion displays the number |
| Mask character | Meaning |
_ (underscore) | Optional. Digit placeholder. |
9 | Optional. Digit placeholder. (Shows decimal places more clearly than _.). Note that when ‘9’ or ‘_’ is used after the decimal place, 0 will be padded, if required. |
. | Location of a mandatory decimal point. |
0 | Located to the left or right of a mandatory decimal point. Pads with zeros. |
( ) | If number is less than zero, puts parentheses around the mask. |
+ | Puts plus sign before positive number; minus sign before negative number. |
- | Puts a space before positive number; minus sign before negative number. |
, | Separates every third decimal place with a comma. |
L,C | Left-justifies or center-justifies number within width of mask column. First character of mask must be L or C. The default value is right-justified. |
$ | Puts a dollar sign before formatted number. First character of mask must be the dollar sign ($). |
^ | Separates left and right formatting. |
| Number | Mask | Result |
4.37 | $ ._ | "$ 4.37" |
4.37 | $_._ | " $4.37" |
| Number | Mask | Result |
-4.37 | - ._ | "- 4.37" |
-4.37 | -_._ | " -4.37" |
| Number | Mask | Result |
3.21 | C(_^_) | "( 3.21 )" |
3.21 | C_(^_) | " (3.21 )" |
3.21 | C(_^)_ | "( 3.21) " |
3.21 | C_(^)_ | " (3.21) " |
<cfscript>
writeOutput(numberFormat(1.23,'__.00')) // Returns 1.23
writeOutput(numberFormat(123,'__.00')) // Returns 123.00
</cfscript>