使用cstr,str和tostring将double转换为字符串 [英] double to string with cstr, str and tostring
本文介绍了使用cstr,str和tostring将double转换为字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试转换时:0.00007965,使用cstr,str或tostring转换为字符串,
它们返回7.965E-05。
我想:0.00007965,有什么方法可以做到吗?或者我必须写一个函数
来做它。
解决方案
< blockquote>使用适当的格式控件类型以固定而不是科学记数法打印值,如 MSDN中所述 [ ^ ]。
您好,
试试这个:
Console.WriteLine(< span class =code-keyword> 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.
这篇关于使用cstr,str和tostring将double转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文