Last active
August 29, 2015 14:02
-
-
Save chancyWu/46c0c8fd19550a1e7343 to your computer and use it in GitHub Desktop.
NSLocale usage
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
NSLocale *lcl = [[NSLocale alloc] initWithLocaleIdentifier:@"en_SG"]; | |
NSNumberFormatter *fmtr = [[NSNumberFormatter alloc] init]; | |
[fmtr setNumberStyle:NSNumberFormatterCurrencyStyle]; | |
[fmtr setLocale:lcl]; | |
NSLog(@"Current Locale: %@", [NSLocale currentLocale]); | |
NSLog(@"Available Locales: %@",[NSLocale availableLocaleIdentifiers]); | |
NSLog( @"%@", [lcl displayNameForKey:NSLocaleCurrencySymbol value:@"en_SG"] ); | |
NSLog( @"%@", [fmtr currencySymbol] ); | |
NSLog(@"CurrencyCode: %@", [lcl objectForKey:NSLocaleCurrencyCode]); | |
NSLog(@"CurrencySymbol: %@", [lcl objectForKey:NSLocaleCurrencySymbol]); | |
NSLog(@"CountryCode: %@",[lcl objectForKey:NSLocaleCountryCode]); | |
NSLog(@"CountryName: %@", [lcl displayNameForKey:NSLocaleCountryCode value:[lcl objectForKey:NSLocaleCountryCode]]); | |
NSLocale *phLcl = [[NSLocale alloc] initWithLocaleIdentifier:@"en_PH"]; | |
NSLog(@"en_PH CurrencyCode: %@",[phLcl objectForKey:NSLocaleCurrencyCode]); | |
NSLog(@"en_PH CurrencySymbol: %@", [phLcl objectForKey:NSLocaleCurrencySymbol]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment