Search code examples
c#localizationcurrency

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


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?


Solution

  • If you don't mind rounding...

    price.ToString("c0")