Convert.ToDouble(“4089.90”) outputs 40.899,00 why?

前端 未结 6 2127
傲寒
傲寒 2021-02-20 16:55

I am developing a software that uses number precision, but I have this problem, it happens that when I take a string to convert to double it outputs me with a different culture.

6条回答
  •  忘了有多久
    2021-02-20 17:54

    You don't say where you are based, but the output is consistent with the current culture being one that has "." as the thousands separator and a decimal comma rather than a decimal point.

    However, you state that the culture is the same - which contradicts this. Have you or the client changed (or customised) the "Standards and formats" on the Regional and Language Options? If the setting has been customised it will still read as "English (United Kingdom)" (or where ever) but will produce different results to the default.

提交回复
热议问题