Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal sign

Status
Not open for further replies.

ojf

Instructor
Sep 27, 2000
49
NO
I have set up my PC to use comma as decimal sign (Windows XP and Windows 2000), but when I enter decimal numbers into textboxes, I have to use the period character, otherwise the javascript will not do calculations with the decimals, i.e. 12,5 + 87,5 = 99, but if I enter 12.5 + 87.5 the sum is calculated to 100.
How do I force my ASP, HTML and Javascript to accept the comma?
 
I'm sorry, but I just have to ask...

Why would you do that? What purpose does it serve?

I know of no way (other than using the replace() function -- which you'd have alot of casting going on -- very innefficient) to make it accept a comma as a numeric value.

I'm just curious. Seems like it would cause alot of headaches.

penny.gif
penny.gif
 
Why I want to do that?
Most of Europe, apart from English-speaking countries use comma as the decimal delimiter. So that's the standard. And when people are asked to place a number in a textbox they will write it like this 123,56

ojf
 
Hmm.. That's interesting. I think Link9 is on the right track, but I'm curious as well.

If someone enters 1,234 is that to be interpreted as

One Thousand Two Hundred and Thirty Four (1,234)

or

One Point Two Three Four (1.234)

I was getting ready to write a small replace function for you and I ran into that.

ToddWW
 
Judging from what you posted, I'll guess it should be:

1.234

If that's the case, then just do this:

dim var
var = request.form("var")
var = cdbl(replace(var,",","."))

var will now hold 1.234 (assuming it used to hold 1,234).

I swear that's the first time I've ever heard of that. Learn something new every single day.

:)
paul
penny.gif
penny.gif
 
ojf,

I would think that this would have to be a Microsoft setup for international installs. Microsoft would have to know this and accomodate for it. How else would you know how to add/multiply/divide with commas instead of decimals through out your whole computer. You can't do a REPLACE for that.

You should call Microsoft support for this one.

fengshui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top