格式数字作为货币 [英] Format number as money
本文介绍了格式数字作为货币的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何格式化了一些看起来像这样::9000
我的数据库字段是货币数据类型,当我拉起我认为是这样的:9000.0000
不看的权利给我(我想它看起来像一个真正的金钱格式)
How do I format a number to look like this: 9,000 my database field is in money data type, when I pull it up I see it like this: 9000.0000 that don't look right to me (I would like it to look like a real money format)
推荐答案
虽然你可以调用的String.Format,我觉得它更容易只是调用的ToString 就可以了。
While you could call string.format, I think it's easier to just call ToString on it.
decimal money = 9000m;
string formattedMoney = money.ToString("C");
这篇关于格式数字作为货币的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文