.NET的String.Format()在千位加逗号的数字 [英] .NET String.Format() to add commas in thousands place for a number

查看:611
本文介绍了.NET的String.Format()在千位加逗号的数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想补充一个逗号在千位的数字。的String.Format()?

解决方案

 的String.Format({0:N},1234);

的String.Format({0:N0},9876); //没有小数点后的数字。
 

I want to add a comma in the thousands place for a number. String.Format()?

解决方案

String.Format("{0:n}", 1234);

string.Format("{0:n0}", 9876); // no digits after the decimal point.

这篇关于.NET的String.Format()在千位加逗号的数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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