Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

.NET String.Format() to add commas in thousands place for a number

I need to add a comma in the place of the large number for a number.
String.Format()
?
by

2 Answers

akshay1995

String.Format("{0:n}", 1234); // Output: 1,234.00
String.Format("{0:n0}", 9876); // No digits after the decimal point. Output: 9,876
kshitijrana14
I found this to be the simplest way:
myInteger.ToString("N0")

Login / Signup to Answer the Question.