Skip to content

Instantly share code, notes, and snippets.

@yunyang088
Created May 21, 2016 09:30
Show Gist options
  • Save yunyang088/e5b3742944a3fa5e9799fc14e54db5f4 to your computer and use it in GitHub Desktop.
Save yunyang088/e5b3742944a3fa5e9799fc14e54db5f4 to your computer and use it in GitHub Desktop.
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.numberStyle=NSNumberFormatterDecimalStyle;
numberFormatter.minimumFractionDigits=2;
numberFormatter.maximumFractionDigits=6;
[numberFormatter setFormatterBehavior:NSNumberFormatterBehaviorDefault];
NSString *formattedNumberString = [numberFormatter stringFromNumber:[NSNumber numberWithDouble:122344.4563111]];
NSLog(@"formattedNumberString: %@", formattedNumberString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment