使用NSNumberFormatterCurrencyStyle时,nb_NO和nn_NO的输出不同

时间:2014-02-04 11:17:02

标签: objective-c nsnumberformatter nslocale

为什么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

0 个答案:

没有答案