Converting String To Float in C#

后端 未结 7 728
渐次进展
渐次进展 2020-11-28 22:12

I am converting a string like \"41.00027357629127\", and I am using;

Convert.ToSingle(\"41.00027357629127\");

or

float.Pars         


        
相关标签:
7条回答
  • 2020-11-28 22:52

    The precision of float is 7 digits. If you want to keep the whole lot, you need to use the double type that keeps 15-16 digits. Regarding formatting, look at a post about formatting doubles. And you need to worry about decimal separators in C#.

    0 讨论(0)
提交回复
热议问题