I have a value 20,55 which is in German language.
When I change the regional settings to US the value gets displayed as 2055.0 after running this code:
double d = Double.Parse("20,55",CultureInfo.CurrentCUCulture);
Why is that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In the US, the decimal separator is
., not,. If you attempt to parse20,55, it will (apparently) ignore the commas as standard triplet separators (such as in1,234,567.89), even though there aren’t three digits in all of them.If you want to parse a Euro-style number, you need to parse it with a Euro-style culture setting.