Skip to content

Instantly share code, notes, and snippets.

@Air-Craft
Created February 6, 2015 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Air-Craft/abf56999e67332a203a8 to your computer and use it in GitHub Desktop.
Save Air-Craft/abf56999e67332a203a8 to your computer and use it in GitHub Desktop.
Format currency in Cocoa using the locale #cocoa #formatting #currency #i8n
NSNumberFormatter *fmt = [[NSNumberFormatter alloc] init];
fmt.numberStyle = NSNumberFormatterCurrencyStyle;
// fmt.alwaysShowsDecimalSeparator = YES;
// fmt.allowsFloats = YES;
// fmt.maximumFractionDigits = 2;
// fmt.locale = [NSLocale currentLocale]; Fixed for now
fmt.locale = [NSLocale localeWithLocaleIdentifier:@"en_GB"];
_priceLbl.text = [fmt stringFromNumber:@(totalPrice)];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment