码迷,mamicode.com
首页 > 其他好文 > 详细

为数据前面加上货币符号

时间:2015-12-14 10:35:28      阅读:157      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!