|
-
Aug 31st, 2004, 03:47 AM
#1
Thread Starter
New Member
String-double conversion
Hello
I want to read a double out of a string. Normally I have no trouble but when I test on another PC, it fails to work. I find that the regional settings are once again bothering me.
There are two ways I know to convert a string to a double - val() and cDbl(). The first is fine if the user has the same settings as me (period for a decimal divider, space as thousands separator) but if they have a different decimal divider, such as a comma or if they use a character as their thousands separator, it will go wrong.
cDbl has a similar problem: it fails to read a decimal period if the regional settings are set to anything else. "4.256" would be read as 4256 if a comma is the decimal divider...
Is there another function I've missed that ignores regional settings completely and simply converts a string to a double?
-
Aug 31st, 2004, 09:24 AM
#2
Thread Starter
New Member
I've fixed it for the scope of regional settings in my office by replacing the first "," in an numberstring with a "." then using val(). Still not foolproof thiugh since some people have ","s as their thousands separator...but hopefully good enough...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|