ios将银行卡号格式化
by 伍雪颖
- (NSString *)formatCardNumber:(NSString *)cardNum { NSNumber *number = @([cardNum longLongValue]); NSNumberFormatter *formatter = [NSNumberFormatter new]; [formatter setUsesGroupingSeparator:YES]; [formatter setGroupingSize:4]; [formatter setGroupingSeparator:@" "]; return [formatter stringFromNumber:number]; }
时间: 2024-10-27 11:28:13