金额类型转换
首先把金額轉換為decimal類型
取四舍五入值后的結果,例如:
?->.toString("n");為1,000,000
->.toString("C");為¥1,000,000
1 /// <summary> 2 /// 對金額進行四舍五入 3 /// </summary> 4 /// <param name="dd"></param> 5 /// <returns></returns> 6 public string MathRound(string dd) 7 { 8 if (!string.IsNullOrEmpty(dd)) 9 { 10 dd = Math.Round(Convert.ToDecimal(dd)).ToString("C"); 11 string[] dds = dd.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries); 12 return dds[0]; 13 } 14 else 15 { 16 return ""; 17 } 18 }?
轉載于:https://www.cnblogs.com/dongbo19910728/archive/2013/06/16/3138544.html
總結
- 上一篇: 搜索与剪枝
- 下一篇: SQL Server 6.5 如何升级到