Formats a number in a locale-specific currency format. For countries that use the euro, the result depends on the JVM.
[type - quicky]
local: the currency format and currency symbol used locally.
- With JDK 1.3, the default for Euro Zone: local currency.
- With JDK 1.4, the default for Euro Zone: euro.
international: the international standard currency format
none: the local currency format; no currency symbol

lsCurrencyFormat(number [, type, locale]) → returns string

Argument Reference

number numeric

type string
Default: local

  • local
  • international
  • none

locale string

Geographic/language locale value, where the format is a combination of an ISO 639-1 code and an optional ISO 3166-1 code separated by a dash or an underscore.
  • en
  • de_DE
  • de_CH
  • ...

Sample code invoking the lsCurrencyFormat function

lsCurrencyFormat returns a currency value using the locale convention. Default value is local.

<!--- loop through list of locales; show currency values for 100,000 units --->
<cfloop LIST = "#Server.Coldfusion.SupportedLocales#"
index = "locale" delimiters = ",">
<cfset oldlocale = setLocale(locale)>
Local: #lsCurrencyFormat(100000, "local")#
International: #lsCurrencyFormat(100000, "international")#
None: #lsCurrencyFormat(100000, "none")#
<hr noshade>

lsCurrencyFormat returns a currency value using the specified locale.

writeDump(lsCurrencyFormat(5, 'local', 'en_US'));

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub