.NET String.Format() 为一个数字在千位添加逗号 [英] .NET String.Format() to add commas in thousands place for a number
本文介绍了.NET String.Format() 为一个数字在千位添加逗号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在数字的千位添加逗号.
I want to add a comma in the thousands place for a number.
String.Format()
?
推荐答案
String.Format("{0:n}", 1234); // Output: 1,234.00
String.Format("{0:n0}", 9876); // No digits after the decimal point. Output: 9,876
这篇关于.NET String.Format() 为一个数字在千位添加逗号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文