LSNumberFormat

Formats a number in a locale-specific format.
[mask - quicky]
_,9 Digit placeholder; . decimal point; 0 Pads with zeros;
( ) less than zero, puts parentheses around the mask
+ plus sign before positive number minus before negative
- a space before positive minus sign before negative
, Separates every third decimal place with a comma.
L,C Left-justifies or center-justifies number
$ dollar sign before formatted number.
^ Separates left and right formatting.

LSNumberFormat(number [, mask]) → returns String

Argument Reference for the LSNumberFormat function

number

Required: Yes

mask

Required: No

Examples sample code invoking the LSNumberFormat function


Tag Example

LSNumberFormat returns a number value using the locale convention.

<!--- loop through a list of locales and show number values ---> 
 <cfloop LIST = "#Server.Coldfusion.SupportedLocales#" 
 index = "locale" delimiters = ","> 
 <cfset oldlocale = setLocale(locale)> 
 <cfoutput><p><b><i>#locale#</i></b> 
 #LSNumberFormat(-1234.5678, "_________")# 
 #LSNumberFormat(-1234.5678, "_________.___")# 
 #LSNumberFormat(1234.5678, "_________")# 
 #LSNumberFormat(1234.5678, "_________.___")# 
 #LSNumberFormat(1234.5678, "$_(_________.___)")# 
 #LSNumberFormat(-1234.5678, "$_(_________.___)")# 
 #LSNumberFormat(1234.5678, "+_________.___")# 
 #LSNumberFormat(1234.5678, "-_________.___")# 
 </cfoutput> 
 </cfloop> 

Fork me on GitHub