How to convert non-Exponential numbers to Exponential number in c#

匿名 (未验证) 提交于 2019-12-03 09:02:45

问题:

we have some calculation in our project like convertion from non-Exponential("1234567890.1234567890" numbers to Exponential("1.234567890E+10") number.

is there any solution for above issue?

please help me to come out from this problem.

回答1:

It seems like you need to use Double.Parse (if you have the number as a string) and then Double.ToString with the appropriate format specifier. For example: number.ToString("E")



回答2:

Use this.

string.Format("{0:#.0#E-00}", NumericValue); 

or

string.Format("{0:E}", NumericValue); 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!