首页 > 其他 > 详细

为数据前面加上货币符号

时间:2015-12-14 10:34:29      阅读:183      评论:0      收藏:0      [点我收藏+]

/// <summary>
/// 商品价格格式
/// </summary>
/// <param name="price"></param>
/// <param name="n"></param>
/// <returns></returns>
public static string GetPrice(this decimal price, int? n = 0)
{
//if (n!=0)
//{

//}
return string.Format("{0:c" + n + "}", price);
}
public static string GetPriceForInt(this int price, int? n = 0)
{
//if (n!=0)
//{

//}
return string.Format("{0:c" + n + "}", price);
}

为数据前面加上货币符号

原文:http://www.cnblogs.com/special-tao/p/5044255.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!