Removing trailing decimals from a .ToString("c") formatted number

Scott Schulthess picture Scott Schulthess · Apr 21, 2009 · Viewed 14.4k times · Source

Basically I am formatting numbers like so

price.ToString("c")

The result is $615.00 in english and 615,00 $ in french.

My desired result, however, is $615 and 615 $, respectively. How can I attain this, while still taking advantage of .nets localization handling?

Answer

John Rasch picture John Rasch · Apr 21, 2009

If you don't mind rounding...

price.ToString("c0")