2012-12-11 46 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)