用逗号分隔数字 [英] Seperating a number with commas
问题描述
我需要一个数字格式的数字。
我从数据库中得到一个没有任何逗号的数字,我需要用逗号分隔它们。 />
例如:如果我有1000,它应该显示为1000
为10000它应该显示为10,000
为100000它应该显示为1,00,000
为1000000它应该显示为10,00,000
等等......
可以任何人请帮助。
我尝试了什么:
我尝试过这个
String.FormatString({0:#,## 0},Convert.ToDouble(HolidaysBookedThisYear))
但它在距离最后一个3位数之后分离。我不希望这样。
Hi,
I need a number in number format.
I am getting a number from database without any commas, I need to seperate them with commas.
for eg: If i have 1000 it should display like 1,000
for 10000 it should display like 10,000
for 100000 it should display like 1,00,000
for 1000000 it should display like 10,00,000
and so on....
can anybody help please.
What I have tried:
I tried like this
String.FormatString("{0:#,##0}",Convert.ToDouble(HolidaysBookedThisYear))
but it is separating after avery 3 digits from last. I don't want that.
推荐答案
尝试指定印度文化:
Try specifying an Indian culture:
string s = String.Format(new CultureInfo("en-IN", false), "{0:n}", 12345678.90);
参考:
< a href =http://stackoverflow.com/questions/25524180/format-numeric-string-with-comma-separator-for-indian-numbering-system>链接
这篇关于用逗号分隔数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!