且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用cstr,str和tostring将double转换为字符串

更新时间:2022-10-24 19:00:37

使用适当的格式控件类型以固定而不是科学记数法打印值,如 MSDN中所述 [ ^ ]。

您好,



试试这个:

 Console.WriteLine( CDec ( 0  00007965 )。ToString) 
' 输出:0.00007965



希望这会有所帮助。


when trying to convert: 0.00007965, to string using cstr, str or tostring,
they return 7.965E-05.

I want: 0.00007965, there''s any way to do it?, or I have to write a function
to do it.

Use the appropriate format control types to print the value in fixed rather than scientific notation as described in MSDN[^].


Hi,

Try this:
Console.WriteLine(CDec(0.00007965).ToString)
' output: 0.00007965


Hope this helps.