我有一些像 11223322 这样的大双。当我转换double
中的NSString
时,我会采用以下格式: 11.223.322 吗?
答案 0 :(得分:2)
尝试使用以下代码;
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle];
[numberFormatter setGroupingSeparator:@"."]; // Here you can change Separator as you want
NSString *formattedNumberString = [numberFormatter stringFromNumber:@11223322];
NSLog(@"formattedNumberString: %@", formattedNumberString);