字符串格式为指数 [英] string format as exponent
本文介绍了字符串格式为指数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个整数表示1,我需要将其格式化为1.000000000E + 003。我怎样才能做到这一点。我用过这段代码..
Hi,
I have an integer number say 1, I need to format that into 1.000000000E+003. How can I achieve this. I used this code..
string HEIGHT = string.Format("{0:0.#########E+003}", Math.Round( height / 1000.000,9));
推荐答案
摘下三个:它打印成一个字符,而不是控制数量你想要的指数数字。如果你想要一个三位数的指数,请执行以下操作:
Take off the three: it prints as a character, not controls teh number of exponent digits you want. If you want a three digit exponent, do this:
string HEIGHT = string.Format("{0:0.#########E+000}", Math.Round(height / 1000.000, 9));
这篇关于字符串格式为指数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文