二话不说直接上代码,调用就好,谢谢
//金钱每三位加一个逗号
+(NSString *)countNumAndChangeformat:(NSString *)num
{
if([num rangeOfString:@"."].location !=NSNotFound) {
NSString *losttotal = [NSString stringWithFormat:@"%.2f",[num floatValue]];//小数点后只保留两位
NSArray *array = [losttotal componentsSeparatedByString:@"."];
//小数点前:array[0]
//小数点后:array[1]
int count =