Possible Duplicate:
.NET String.Format() to add commas in thousands place for a number
How to format a number 1234567 into 1,234,567 in C#?
Possible Duplicate:
.NET String.Format() to add commas in thousands place for a number
How to format a number 1234567 into 1,234,567 in C#?
It depends on the culture of your computer. Some countries use commas, some countries use dots. On my computer the output was: 123.456.789
or without cents
For format options for Int32.ToString(), see here or here.
For example:
The same format options can be use in a String.Format, as in
Do note that the
,
in that format doesn't specify a "use a comma" but rather that the grouping character for the current culture should be used, in the culture-specific positions.So you get "1 234 567 890" for pl-PL or "1,23,45,67,890" for hi-IN.
Using your current locale's thousands separator:
Or, use the overload to ToString, which takes the culture as a parameter.
Try String.Format("{0:##,####,####}", 8958712551)
For Examples have a look at http://www.csharp-examples.net/string-format-double/