Double.Parse - Internationalization problem

前端 未结 6 662
故里飘歌
故里飘歌 2020-12-17 10:04

This is driving me crazy. I have the following string in a ASP.NET 2.0 WebForm Page

string s = \"0.009\";

Simple enough. Now, if my culture

6条回答
  •  暖寄归人
    2020-12-17 10:53

    I think you are interpreting it the wrong way around, in es-ES culture 0.009 is really just a long way of saying 9, as the "." is not the decimal separator, so if you ask for the string "0.009" to be parsed with the es-ES culture you should indeed get the deouble 9.0. If you ask it to parse "0,009" you should get a double of 0.009.

    Similarly, if you ask it to format the double 0.009 you should get the string "0,009" in es-ES.

提交回复
热议问题