//@"123456789" 转换后 @"123,456,789"
@interface NSString (num) - (NSString *)money; @end @implementation NSString (num) - (NSString *)money{ NSNumberFormatter *numFormat = [[NSNumberFormatter alloc] init]; [numFormat setNumberStyle:NSNumberFormatterDecimalStyle]; NSNumber *num = [NSNumber numberWithDouble:[self doubleValue]]; return [numFormat stringFromNumber:num]; } @end
时间: 2024-11-26 03:18:40