How to convert double to string without the power to 10 representation (E-05)

后端 未结 4 1575
死守一世寂寞
死守一世寂寞 2020-12-01 16:42

How to convert double to string without the power to 10 representation (E-05)

double value = 0.000099999999833333343;
string text = value.ToString();
Consol         


        
相关标签:
4条回答
  • 2020-12-01 17:17

    Use String.Format() with the format specifier. I think you want {0:F20} or so.

    string formatted = String.Format("{0:F20}", value);
    
    0 讨论(0)
  • 2020-12-01 17:19

    You don't need string.Format(). Just put the right format string in the existing .ToString() method. Something like "N" should do.

    0 讨论(0)
  • 2020-12-01 17:20

    Use string.Format with an appropriate format specifier.

    This blog post has a lot of examples: http://blogs.msdn.com/kathykam/archive/2006/03/29/564426.aspx

    0 讨论(0)
  • 2020-12-01 17:33

    How about

    Convert.ToDecimal(doubleValue).ToString()
    
    0 讨论(0)
提交回复
热议问题