2012-12-11 71 views
5

可能重複:
How do I format a double to currency rounded to the nearst dollar?在貨幣刪除小數

如何從貨幣除去小數?

這是我如何格式的數字貨幣:

string.Format("{0:C}", Amount) 

輸出爲$ 20,000,000.00但我需要提前$ 20,000,000

感謝

+3

我相信這會回答你的問題: http://stackoverflow.com/questions/890100/how-do-i-format-a-double-to-currency-rounded-to-the-nearst-dollar – Pete

+0

Amount.Trim('0')。修剪('。'); – Nisar

回答

25

指定要零小數位:

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