place a comma after each 3 digit in a 9 digit numbe in c#?
Possible Duplicates:
.NET String.Format() to add commas in thousands place for a number
Add comma to numbers every three digits using C#
I want to create a logic in c# too put the comma after each 3 digit int the any 9 digit number, could any body tel me how can i achieve this?
Like i have the following number 123456789 then i want to form it like 123,456,789.
调用ToString并指定“N”作为格式字符串
var formattedString = string.Format("{0:0,0}", 123456789);
double value = 1234567890;
Console.WriteLine(value.ToString("#,#", CultureInfo.InvariantCulture));
链接地址: http://www.djcxy.com/p/50542.html
上一篇: 在C#中向数千人添加逗号