为什么0.ToString(QUOT;###"。)返回一个空字符串,而不是0.00或至少是0? [英] Why does 0.ToString("#.##") return an empty string instead of 0.00 or at least 0?

查看:842
本文介绍了为什么0.ToString(QUOT;###"。)返回一个空字符串,而不是0.00或至少是0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 0.ToString(###)返回一个空字符串?难道不应该是 0.00 至少0

Why does 0.ToString("#.##") return an empty string? Shouldn't it be 0.00 or at least 0?

推荐答案

中的字符串格式指明该值是可选的。如果你希望得到的输出 0.00 需要具备以下条件:

# in the string format indicate that the value is optional. If you wish to get the output 0.00 you need the following:

0.ToString("0.00");

请参阅这里自定义数字格式可以传递给此方法。

See here for the custom numeric formats that can be passed to this method.

这篇关于为什么0.ToString(QUOT;###"。)返回一个空字符串,而不是0.00或至少是0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆