Converts a locale-specific currency string into a formatted number. Attempts conversion by comparing the string with each the three supported currency formats (none, local, international) and using the first that matches.
A formatted number (string representation of a number) that matches the value of the parameter.
LSParseCurrency(currency [, locale])
LSParseEuroCurrency, LSCurrencyFormat, LSEuroCurrencyFormat, LSIsCurrency; Locale-specific content in the Developing ColdFusion Applications
Parameter |
Description |
|---|---|
currency |
A locale-specific string a variable that contains one |
locale |
Locale to use instead of the locale of the page when processing the function |
This function uses the locale formatting rules of the JVM (specified in the ColdFusion Administrator Java and JVM page) on all platforms. These rules changed between Sun JVM 1.3.1 and JVM 1.4.1:
JVM 1.4.1 requires that currencies for Euro zone countries be expressed as euros; for example 100.000,00 BADCHAR or EUR100.000,00.
Note: The LSIsCurrency function always returns True if the locale is in the Euro currency zone and the currency is expressed in euros, including when using JVM 1.3.1. As a result, with older JVMs, LSIsCurrency does not ensure that LSParseCurrency returns a value. |
To set the default display format of date, time, number, and currency values, use the SetLocale function. For a list of the locale-specific formats used to parse the currency, see LSCurrencyFormat.
<cfscript>
currency="$125"
locale=getLocale()
writeOutput("Locale is: " & locale & "<br/>")
writeOutput(LSParseCurrency(currency,locale))
</cfscript>
Output
Locale is: English (US)
125.0
Sign in to your account