Double.TryParse() input decimal separator different than system decimal separator

Posted by mare on Stack Overflow See other posts from Stack Overflow or by mare
Published on 2010-05-16T17:57:46Z Indexed on 2010/05/16 18:00 UTC
Read the original article Hit count: 519

Filed under:
|
|
|

I have a source XML that uses a dot (".") as a decimal separator and I am parsing this on a system that uses a comma (",") as a decimal separator.

As a result, value of 0.7 gets parsed with Double.TryParse or Double.Parse as 7000000.

What are my options to parse correctly? One of them is to replace dots in source with commas with String.Replace('.', ',') but I don't think I like this very much.

© Stack Overflow or respective owner

Related posts about double

Related posts about parse