c# - ToString ("N2") 和 ToString ("0.00") 之间的区别

标签 c# formatting

ToString("N2")ToString("0.00")有什么区别?

最佳答案

来自 Standard Numeric Format Strings

The number is converted to a string of the form "-d,ddd,ddd.ddd…", where '-' indicates a negative number symbol if required, 'd' indicates a digit (0-9), ',' indicates a thousand separator between number groups, and '.' indicates a decimal point symbol.

似乎 N 将包含千位分隔符,而 0.00 不会。

另见 Custom Numeric Format Strings

关于c# - ToString ("N2") 和 ToString ("0.00") 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4506323/

相关文章:

excel - NPOI:实现像Excel格式化一样的货币格式

c# - 中止线程(Backgroundworker)..需要建议

c# - 为什么我的 Stopwatch.Frequency 这么低?

c# - 在 C# 中将 JSON 字符串解析为 JSON 对象,而无需编写额外的对象类

ios - 在 TextField 中格式化部分文本

c# - 在C#中将double格式化为字符串

javascript - 隐藏 3 段后的内容 <p>

c# - 函数的别名

c# - 如何避免在 MDIParent C# Winforms 中显示多个子窗体

scala - 如何在 Scala 中打印 map