place a comma after each 3 digit in a 9 digit numbe in c#? [duplicate]
Possible Duplicates:
开发者_Python百科 .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.
Call ToString and specify "N" as the format string
var formattedString = string.Format("{0:0,0}", 123456789);
double value = 1234567890;
Console.WriteLine(value.ToString("#,#", CultureInfo.InvariantCulture));
精彩评论