/t5/coldfusion-discussions/thousand-and-decimal-seperators/td-p/880507Oct 20, 2008
Oct 20, 2008
Copy link to clipboard
Copied
Hi all,
I have a question I need to convert a european number (. as
thousand seperator and a , as decimal seperator) to an american
number. But I could recieve both type of numbers. So when I get an
american number delivered I want to do nothing and in case of an
european number I want to convert it.
Is there a method to determine what kind of number I'm
dealing with?
/t5/coldfusion-discussions/thousand-and-decimal-seperators/m-p/880508#M81090Oct 20, 2008
Oct 20, 2008
Copy link to clipboard
Copied
Bit confused by your question, but I would probably use the
LSCurrencyFormat(number [, type, locale]) function to display your
number. CF8 allows you to pass the locale in so just set it to
whatever region you want.
/t5/coldfusion-discussions/thousand-and-decimal-seperators/m-p/880512#M81094Oct 20, 2008
Oct 20, 2008
Copy link to clipboard
Copied
Hi,
When a user enters a number you can use LSParseNumber to
convert the entered value into a "real number". You can use
LSNumberFormat to format a internal value for display in a local
format.
There are also functions to parse and format dates and
currencies.
All these functions are converting values depending on the
local that is set on the page ( with a "SetLocale"-function).
To be able to parse and format these values you need to be
able to identify the local by either having a customer select his
country from a listbox / user account, or knowing that the customer
went as example to the German site, and local needs to be set to
de_DE.
cheers,
fober
(updated the example local)
Here's an example function to list all the available locals:
======================================================
<table>
<cfloop index="x"
list="#Server.ColdFusion.SupportedLocales#">
<cfoutput>
<tr>
<td>#x#</td>
<td>#GetLocaleDisplayName(x)#</td>
</tr>
</cfoutput>
</cfloop>
</table>