C# 指数(“E”)格式说明符
(“E”)格式说明符将数字转换为以下格式的字符串 −
"-d.ddd…E+ddd"
或
"-d.ddd…e+ddd"
上面,“d”是数字(0-9)。
用“E”或“e”为指数添加前缀。
示例
using System; using System.Globalization; class Demo { static void Main() { double d = 3452.7678; Console.WriteLine(d.ToString("E", CultureInfo.InvariantCulture)); Console.WriteLine(d.ToString("E10", CultureInfo.InvariantCulture)); Console.WriteLine(d.ToString("e", CultureInfo.InvariantCulture)); Console.WriteLine(d.ToString("e10", CultureInfo.InvariantCulture)); } }
输出
3.452768E+003 3.4527678000E+003 3.452768e+003 3.4527678000e+003
广告