+(NSString *)FormattedAmount:(NSString *)money{ NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init]; formatter.numberStyle =kCFNumberFormatterDecimalStyle; formatter.maximumFractionDigits = 2; //设置最大小数点后的位数 formatter.minimumFractionDigits = 2; //设置最小小数点后的位数 formatter.roundingMode = NSNumberFormatterRoundHalfUp; NSString *newmoney = [formatter stringFromNumber:[NSNumber numberWithDouble:[money doubleValue]]]; return newmoney; } |