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

Issue

I want to add a comma in the thousands place for a number.

Would String.Format() be the correct path to take? What format would I use?

Solution

String.Format("{0:n}", 1234);  // Output: 1,234.00
String.Format("{0:n0}", 9876); // No digits after the decimal point. Output: 9,876

Answered By – Seibar

Answer Checked By – Gilberto Lyons (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *