Best way to parse float?

后端 未结 10 1093
无人及你
无人及你 2020-12-02 22:52

What is the best way to parse a float in CSharp? I know about TryParse, but what I\'m particularly wondering about is dots, commas etc.

I\'m having problems with my

10条回答
  •  半阙折子戏
    2020-12-02 23:17

    you can know current Cuklture of your server with a simple statement:

    System.Globalization.CultureInfo culture = System.Globalization.CultureInfo.CurrentCulture;
    

    Note that there id a CurrentUICulture property, but UICulture is used from ResourceMeanager form multilanguages applications. for number formatting, you must considere CurrentCulture.

    I hope this will help you

提交回复
热议问题