String.Format way to format Currency without Cents

Grahame A picture Grahame A · Aug 31, 2010 · Viewed 42.9k times · Source

I'm displaying currency using the current method

String.Format("{0:C}", item.DonationAmount)

Which outputs like $10.00

We will be dealing with large dollar amounts, and no cents. We would like the currency to display as $10 without the decimal or zeroes. How can I do this? Removing the currency format makes the number display like 10.0000 :( thanks in advance.

Answer

stuartd picture stuartd · Aug 31, 2010

Specify you want zero decimal places:

String.Format("{0:C0}", item.DonationAmount)