为什么nb_NO和nn_NO都没有以相同的方式格式化?我错过了什么?
#import <Foundation/Foundation.h>
void printPrice(NSNumber *price, NSLocale *locale)
{
NSNumberFormatter *numberFormatter = [NSNumberFormatter new];
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
numberFormatter.locale = locale;
NSString *string = [numberFormatter stringFromNumber:@120];
printf("%s\n", [string UTF8String]);
}
int main(int argc, char *argv[]) {
@autoreleasepool {
{
NSString *identifier = @"nb_NO";
NSLocale *locale = [NSLocale localeWithLocaleIdentifier:identifier];
printPrice(@120, locale);
}
{
NSString *identifier = @"nn_NO";
NSLocale *locale = [NSLocale localeWithLocaleIdentifier:identifier];
printPrice(@120, locale);
}
}
}
输出继电器
kr 120,00
120,00 kr