LSEuroCurrencyFormat

Description

Formats a number in a locale-specific currency format.

Return value

A formatted value.

Category

Display and formatting functions, International functions

Syntax

LSEuroCurrencyFormat(currency-number [, type ]) 

See also

LSParseEuroCurrency, LSCurrencyFormat, SetLocale

History

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.)

Parameters

Parameter Description
currency-number
Currency value.
type
  • local: the currency format used in the locale. (Default.)
  • international: the international standard currency format of the locale.
    For example, EUR10.00
  • none: the currency format used in the locale; no currency symbol

Usage

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

Currency output

The following table shows examples of currency output:
Locale Type = local Type = international Type = none
Dutch (Belgian)
100.000,00 

EUR100.000,00 

100.000,00 

Dutch (Standard)
€100.000,00 

EUR100.000,00 

100.000,00 

English (Australian)
€100,000.00 

EUR100,000.00 

100,000.00 

English (Canadian)
€100,000.00 

EUR100,000.00 

100,000.00 

English (New Zealand)
€100,000.00 

EUR100,000.00 

100,000.00 

English (UK)
€100,000.00 

EUR100,000.00 

100,000.00 

English (US)
€100,000.00 

EUR100,000.00 

100,000.00 

French (Belgian)
100.000,00 € 

EUR100.000,00 

100.000,00 

French (Canadian)
100 000,00 € 

EUR100 000,00 

100 000,00 

French (Standard)
100 000,00 € 

EUR100 000,00 

100 000,00 

French (Swiss)
€100'000.00 

EUR100'000.00 

100'000.00 

German (Austrian)
€100.000,00 

EUR100.000,00 

100.000,00 

German (Standard)
100.000,00 € 

EUR100.000,00 

100.000,00 

German (Swiss)
€100'000.00 

EUR100'000.00 

100'000.00 

Italian (Standard)
€10.000.000 

EUR10.000.000 

10.000.000 

Italian (Swiss)
€100'000.00 

EUR100'000.00 

100'000.00 

Norwegian (Bokmal)
€100 000,00 

EUR100 000,00 

100 000,00 

Norwegian (Nynorsk)
€100 000,00 

EUR100 000,00 

100 000,00 

Portuguese (Brazilian)
€100.000,00 

EUR100.000,00 

100.000,00 

Portuguese (Standard)
€100.000,00 

EUR100.000,00 

100.000,00 

Spanish (Mexican)
€100,000.00 

EUR100,000.00 

100,000.00 

Spanish (Modern)
10.000.000 €  

EUR10.000.000 

10.000.000 

Spanish (Standard)
10.000.000 €  

EUR10.000.000 

10.000.000 

Swedish
100.000,00 €  

EUR100.000,00 

100.000,00 

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)  

Example

<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>

Comments