LSParseCurrency

Description

Converts a locale-specific currency string to a number. Attempts conversion through each of the default currency formats (none, local, international). Returns the number matching the value of string.

Category

International functions

Syntax

LSParseCurrency(string) 

See also

LSCurrencyFormat, LSParseEuroCurrency

Parameters

Parameter
Description
string
The locale-specific string to convert to a number

Currency output

The following table shows sample currency output for some locales supported by ColdFusion in each of the format types: local, international, and none.
Locale
Format Type Output
Dutch (Belgian)
Local: 100.000,00 BF
International: BEF100.000,00
None: 100.000,00 
Dutch (Standard)
Local: fl 100.000,00
International: NLG100.000,00
None: 100.000,00 
English (Australian)
Local: $100,000.00
International: AUD100,000.00
None: 100,000.00 
English (Canadian)
Local: $100,000.00
International: CAD100,000.00
None: 100,000.00 
English (New Zealand)
Local: $100,000.00 
International: NZD100,000.00
None: 100,000.00 
English (UK)
Local: £100,000.00
International: GBP100,000.00
None: 100,000.00 
English (US)
Local: $100,000.00
International: USD100,000.00
None: 100,000.00 
French (Belgian)
Local: 100.000,00 FB
International: BEF100.000,00
None: 100.000,00 
French (Canadian)
Local: 100 000,00 $
International: CAD100 000,00
None: 100 000,00 
French (Standard)
Local: 100 000,00 F
International: FRF100 000,00
None: 100 000,00 
French (Swiss)
Local: SFr. 100'000.00
International: CHF100'000.00
None: 100'000.00 
German (Austrian)
Local: öS 100.000,00
International: ATS100.000,00
None: 100.000,00 
German (Standard)
Local: 100.000,00 DM
International: DEM100.000,00
None: 100.000,00 
German (Swiss)
Local: SFr. 100'000.00
International: CHF100'000.00
None: 100'000.00 
Italian (Standard)
Local: L. 10.000.000
International: ITL10.000.000
None: 10.000.000 
Italian (Swiss)
Local: SFr. 100'000.00
International: CHF100'000.00
None: 100'000.00 
Norwegian (Bokmal)
Local: kr 100 000,00
International: NOK100 000,00
None: 100 000,00 
Norwegian (Nynorsk)
Local: kr 100 000,00
International: NOK100 000,00
None: 100 000,00 
Portuguese (Brazilian)
Local: R$100.000,00
International: BRC100.000,00
None: 100.000,00 
Portuguese (Standard)
Local: R$100.000,00
International: BRC100.000,00
None: 100.000,00 
Spanish (Mexican)
Local: $100,000.00
International: MXN100,000.00
None: 100,000.00 
Spanish (Modern)
Local: 10.000.000 Pts
International: ESP10.000.000
None: 10.000.000 
Spanish (Standard)
Local: 10.000.000 Pts
International: ESP10.000.000
None: 10.000.000 
Swedish
Local: 100.000,00 kr
International: SEK100.000,00
None: 100.000,00 

Example

<!--- This example shows LSParseCurrency --->
<html>
<head>
<title>LSParseCurrency Example</title>
</head>

<body>
<H3>LSParseCurrency Example</H3>

<P>LSParseCurrency coverts a local-specific currency
string to a number. Attempts conversion through each of
the three default currency formats.

<!--- loop through a list of locales and
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, "local")#<BR>
    Currency Number: #LSParseCurrency(LSCurrencyFormat(123456,"local"))#<BR>
    International: #LSCurrencyFormat(123456, "international")#<BR>
    None: #LSCurrencyFormat(123456, "none")#<BR>
    <Hr noshade>
  </cfoutput>
</CFLOOP>

</body>
</html>