为什么当我解析小数点 (0) ToString 时,我的字符串在使用该方法时显示为空:
String somthing = someDecimal.ToString("#")
当我使用时:
String somthing = somDecimal.ToString("0.##")
字符串显示为 0
?
当我在 Debug模式下以两种方式查看值时,它说它们中有一个“0”。
最佳答案
Note that this specifier never displays a zero that is not a significant digit, even if zero is the only digit in the string. It will display zero only if it is a significant digit in the number that is being displayed.
如果要显示小数点后的数字,需要使用0.00
而不是0.##
。
关于c# - 如何将 0 小数解析为字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22981660/