我有一些双精度值,我想用下面的模式转换成一个字符串:
0.xx or x.xx目前我已经尝试过了:
double.ToString("#.#0");如果我的数字以零开始,我应该添加什么才能看到零?
发布于 2012-03-26 17:10:07
只需使用
myDouble.ToString("0.00")这应该会起作用。
发布于 2012-03-26 17:16:27
myDouble.ToString("N2")也应该行得通。
看一看
MSDN: Custom Numeric Format Strings
MSDN: Standard Numeric Format Strings
发布于 2012-03-26 17:09:42
String.Format("{0:0.00}", 111.0);https://stackoverflow.com/questions/9869346
复制相似问题