Adobe ColdFusion 8

LSParseEuroCurrency

Description

Formats a locale-specific currency string as a number. Attempts conversion through each of the default currency formats (none, local, international). Ensures correct handling of euro currency for Euro zone countries.

Returns

A formatted number that matches the value of the string.

Category

International functions, String functions

Function syntax

LSParseEuroCurrency(currency-string [, locale])

See also

LSParseCurrency, LSEuroCurrencyFormat, SetLocale; "Locale-specific content" in the ColdFusion Developer's Guide

History

ColdFusion 8: Added the locale parameter.

ColdFusion MX: Changed formatting behavior: this function might return different formatting than in earlier releases. This function uses Java locale formatting rules on all platforms, except that it uses the rule detailed in the Usage section for countries in the Euro currency zone.

Parameters

Parameter

Description

currency-string

Locale-specific string or a variable that contains one.

locale

Locale to use instead of the locale of the page when processing the function

Usage

This function determines whether the current locale's country belongs to the Euro Zone, whose members have converted to the euro; if so, the currency-string parameter must be formatted in euros on all JVMs, including Sun JVM 1.3.1. If the country is not in the Euro zone, the string must follow the locale formatting rules of the JVM. For examples of valid currency formats in all supported locales, see LSEuroCurrencyFormat.

For a list of the locale options that ColdFusion supports, and information on setting the default display format of date, time, number, and currency values, see SetLocale.

Example

<h3>LSParseEuroCurrency Example</h3>
<p>Loop through all available locales. Create string representations of the value
    123,456 in the three supported currency formats, 
    and parse the results back to numbers.<p>
<cfloop list="#Server.Coldfusion.SupportedLocales#" index="locale" delimiters=",">
    <cfset oldlocale = SetLocale(locale)>
    <cfoutput><p>Current Locale: <b><i>#locale#</i></b><br>
    <cfset localCurrency = LSEuroCurrencyFormat(123456, "local")>
        Value in local currency: #localCurrency#<br>
        Parsed using LSParseEuroCurrency: 
        #LSParseEuroCurrency(localCurrency)#<br>
    <cfset IntlCurrency = LSEuroCurrencyFormat(123456, "international")>
        Value with International currency formatting: #IntlCurrency#<br>
        Parsed using LSParseEuroCurrency: 
        #LSParseEuroCurrency(IntlCurrency)#<br>
    <cfset Currency = LSEuroCurrencyFormat(123456, "none")>
        Value with no currency formatting: #currency#<br>
        Parsed using LSParseEuroCurrency: 
        #LSParseEuroCurrency(Currency)#<br>
        <hr noshade>
    </cfoutput>
</cfloop>