Formats a number in a locale-specific currency format.
Display and formatting functions, International functions
LSEuroCurrencyFormat(currency-number [, type ])
LSParseEuroCurrency,
LSCurrencyFormat,
SetLocale
New in ColdFusion MX: This function might return different formatting than in earlier releases. This function uses Java standard locale formatting rules on all platforms. This function determines whether the current locale's country belongs to the Euro Zone (whose members have converted to the euro); if so, it displays the value in the locale's euro format. (Earlier releases formatted output with the euro symbol regardless of the locale or Euro Zone membership.)
This function uses Java standard locale formatting rules on all platforms.
For a list of the locale options that ColdFusion supports, see SetLocale.
To set the default display format of date, time, number, and currency values, use the SetLocale function.
The following example shows differences between earlier ColdFusion releases and ColdFusion MX in accepting input formats and displaying output:
<cfset oldlocale = SetLocale("German (Standard)")> <cfoutput> New Locale = #getLocale()# <br> <cfset z= LSEuroCurrencyFormat(1234.56, "local")> <cfset x= LSParseEuroCurrency("EUR1.234,56")> <cfset y= LSIsCurrency("DEM1.234,56")> <cfset k= LSIsCurrency("EUR1.234,56")> <br> Euro CurrFormat : #z# <br> Parsed Euro Value: #x#<br> IsCurrency(DEM): #y#<br> IsCurrency(EUR): #k#<br> </cfoutput>
ColdFusion MX produces the following output:
New Locale = German (Standard) Euro CurrFormat : 1.234,56 € Parsed Euro Value: 1234.56 IsCurrency(DEM): NO IsCurrency(EUR): YES
Earlier ColdFusion releases produce the following output:
New Locale = German (Standard) Euro CurrFormat : 1.234,56 € Parsed Euro Value: 1234.56 IsCurrency(DEM): YES IsCurrency(EUR): NO
The following table shows examples of currency output:
Note: ColdFusion uses the Spanish (Standard) formats for Spanish (Modern) and Spanish (Standard).
The following example shows how the function formats negative values. The format includes a negative sign before the value, or parentheses around the value, according to the formatting rules of the current locale.
Input value | Output if locale = French (Standard) | Output if locale = English (US) |
-1234.56 |
-1 234,56 € |
($1,234.56) |
<h3>LSEuroCurrencyFormat Example</h3> <p>LSEuroCurrencyFormat 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)> <cfoutput><p><B><I>#locale#</I></B><br> Local: #LSEuroCurrencyFormat(100000, "local")#<br> International: #LSEuroCurrencyFormat(100000, "international")#<br> None: #LSEuroCurrencyFormat(100000, "none")#<br> <Hr noshade> </cfoutput> </cfloop>