Jump to content
  • Advertisement
Sign in to follow this  
vegi

String Convert fails [c#]

This topic is 3318 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, i want to read numbers from strings. The Input String is "3399084.171875".I tryed to convert it with Convert.ToDouble but the result is "3399084171875.0". Any idea why ? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by vegi
Hi,

i want to read numbers from strings. The Input String is "3399084.171875".I tryed to convert it with Convert.ToDouble but the result is "3399084171875.0".

Any idea why ?

Thanks.


In your country format is "." the decimal separator? because if you call Convert.ToDouble without a specific culture it use the default one of your country. (Probably in your country the "," is the decimal separator)

Share this post


Link to post
Share on other sites
A better option might just be to use the correct culture when doing the string conversion. Of course, that is only if you care about localization.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!