Created
February 6, 2015 16:36
-
-
Save Air-Craft/abf56999e67332a203a8 to your computer and use it in GitHub Desktop.
Format currency in Cocoa using the locale #cocoa #formatting #currency #i8n
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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