User Guide
760 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; “Handling data in ColdFusion MX” in Chapter 17, “Developing
Globalized Applications,” in ColdFusion MX Developer’s Guide
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).










