ios数字格式化为千分符分割的字符串

NSNumberFormatter *format = [[NSNumberFormatter alloc]init];

[format setGroupingSize:3];

[format setGroupingSeparator:@","];

[format setUsesGroupingSeparator:YES];

NSNumber *num = [NSNumber numberWithInt:123456789];

NSString *strValue = [format stringFromNumber:num];

NSLog(@"*.*%@",strValue);//打印结果*.*123,456,789

你可能感兴趣的:(ios数字格式化为千分符分割的字符串)