User Guide
610 Chapter 3: ColdFusion Functions
LSNumberFormat
Description
Formats a number in a locale-specific format.
Returns
A formatted number.
• If no mask is specified, it returns the number formatted as an integer
• If no mask is specified, truncates the decimal part; for example, it truncates 34.57 to 35
• If the specified mask cannot correctly mask a number, it returns the number unchanged
• If the parameter value is "" (an empty string), it returns 0.
Category
Display and formatting functions, International functions
Function syntax
LSNumberFormat(number [, mask ])
See also
GetLocale, SetLocale
History
ColdFusion MX:
• Changed behavior: if the specified mask format cannot correctly mask a number, this function
returns the number unchanged. (In earlier releases, it truncated the number or threw an error.)
(If no mask is specified, ColdFusion MX truncates the decimal part as ColdFusion 5 does. For
example, it truncates 1234.567 to 1235.)
• Changed formatting behavior: this function might return different formatting than in earlier
releases. This function uses Java standard locale formatting rules on all platforms.
Parameters
The following table lists the LSNumberFormat mask characters.
Parameter Description
number Number to format
mask LSNumberFormat mask characters apply, except: dollar sign, comma, and dot are
mapped to their locale-specific equivalents.
Character Meaning
_ (Underscore.) Digit placeholder.
9 Digit placeholder. (Shows decimal places more clearly than _ .)
. Location of a mandatory decimal point (or locale-appropriate symbol).
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.