|
-
Jul 7th, 2006, 08:35 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] float.Parse() should always take "." as decimal seperator.
Hi,
I am trying the following
String str = "1.3";
float f = float.Parse(str);
On an american system this will work perfectly.
result: f = 1.3
However in some european countries "." is not the decimal seperator but "," is the decimal seperator.
result: f = 13
I need to get this code running on all platforms though. I could ofcourse just replace the "," and "." signs. But then it would no longer run on american systems.
How is this problem normally fixed? In my program "." should always be seen as a decimal seperator.
This is important because I am reading files with coordinates that need to be parsed correctly. In these files (*.x3d) the "." sign is the decimal seperator.
Thanks in advance for all help!
____________________________________________
Please rate my messages. Thank you!
____________________________________________
Bram Vandenbon
http://www.bramvandenbon.com
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
|