//Decimal类型的值处理为财务的四舍五入,保留2位小数,不足补0的处理 public static string op_moneyx(this Decimal x) { string str = string.Concat((object) Math.Round(x, 2, MidpointRounding.AwayFromZero)); if (!str.Contains(".")) return str + ".00"; if (str.Split('.')[1].Length != 2) str += "0"; return str; }
记录一下该代码片段方便后续Copy.
标签:四舍五入,string,处理,Decimal,str,小数 From: https://www.cnblogs.com/IBPM/p/17024302.html