Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 240
Scott Schulthess Avatar asked Apr 21 '09 20:04

Scott Schulthess


1 Answers

If you don't mind rounding...

price.ToString("c0") 
like image 145
John Rasch Avatar answered Oct 17 '22 00:10

John Rasch