Name

LSNumberFormat

Synopsis

LSNumberFormat(number [, mask])

Returns number formatted according to mask using the locale convention. If no value is specified for mask, LSNumberFormat( ) returns number as an integer. Valid entries for mask are the same as for NumberFormat( ). The following example applies the function to various numbers for each locale:

<CFLOOP INDEX="locale" LIST="#Server.Coldfusion.SupportedLocales#">
  <CFSET temp = SetLocale(locale)>
  <CFOUTPUT>
    <P><B>#locale#</B><BR>
    LSNumberFormat(1000.99, '____'): #LSNumberFormat(1000.99, '____')#<BR>
    LSNumberFormat(1000.99, '9999.99'): #LSNumberFormat(1000.99, '9999.99')#<BR>
    LSNumberFormat(1000.99, '09999.9900'): 
      #LSNumberFormat(1000.99, '09999.9900')#<BR>
    LSNumberFormat(-1000.99, '(9999.99)'): 
      #LSNumberFormat(-1000.99, '(9999.99)')#<BR>
    LSNumberFormat(1000.99, '+9999.99'): 
      #LSNumberFormat(1000.99, '+9999.99')#<BR>
    LSNumberFormat(-1000.99, '+9999.99'): 
      #LSNumberFormat(-1000.99, '+9999.99')#<BR>    
    LSNumberFormat(1000.99, '-9999.99'): 
      #LSNumberFormat(1000.99, '-9999.99')#<BR>
    LSNumberFormat(-1000.99, '-9999.99'): 
      #LSNumberFormat(-1000.99, '-9999.99')#<BR>
    LSNumberFormat(1000.99, '$9,999.99'): 
      #LSNumberFormat(1000.99, '$9,999.99')#<BR>
    LSNumberFormat(1000.99, 'L999,999.99'): 
      #LSNumberFormat(1000.99, 'L999,999.99')#<BR>
    LSNumberFormat(1000.99, 'C999,999.99'): 
      #LSNumberFormat(1000.99, 'C999,999.99')#<BR>
    LSNumberFormat(1000.99, 'C_____(^___)'): 
      #LSNumberFormat(1000.99, 'C_____(^___)')#<BR>
  </CFOUTPUT>
</CFLOOP>

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.