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.
International functions, String functions
LSParseCurrency
(string)
LSParseEuroCurrency
,
LSCurrencyFormat
,
LSEuroCurrencyFormat
,
LSIsCurrency
ColdFusion MX: Changed formatting behavior: this function might return different formatting than in earlier releases. This function uses Java standard locale formatting rules on all platforms.
Parameter | Description |
---|---|
string |
A locale-specific string a variable that contains one |
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:
LSParseEuroCurrency
function to parse euro currencies in these locales with JVM 1.3.1.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.
See LSCurrencyFormat for a list of the local-specific formats used to parse the currency.
<h3>LSParseCurrency Example</h3> <p>LSParseCurrency coverts a locale-specific currency string to a number.
Attempts conversion through each of the three default currency formats. <!--- loop through a list of locales; show currency values for 123,456 units ---> <cfloop LIST = "#Server.Coldfusion.SupportedLocales#" index = "locale" delimiters = ","> <cfset oldlocale = SetLocale(locale)> <cfoutput><p><B><I>#locale#</I></B><br> Local: #LSCurrencyFormat(123456.78, "local")#<br> Parsed local Currency:
#LSParseCurrency(LSCurrencyFormat(123456,"local"))#<br> International: #LSCurrencyFormat(123456.78999, "international")#<br> Parsed International Currency:
#LSParseCurrency(LSCurrencyFormat(123456.78999,"international"))#<br> None: #LSCurrencyFormat(123456.78999, "none")#<br> Parsed None formatted currency:
#LSParseCurrency(LSCurrencyFormat(123456.78999,"none"))#<br> <hr noshade> </cfoutput> </cfloop>