我尝试通过以下方式输出具有正确小数分隔符的十进制数的描述:
NSString* strValue = @"9.94300";
NSDecimalNumber* decimalNumber = [NSDecimalNumber decimalNumberWithString: strValue];
NSLocale* locale = [NSLocale currentLocale];
NSLog(@"%@", [locale localeIdentifier]);
NSLog(@"%@", [decimalNumber descriptionWithLocale: locale] );
输出是:
de_DE
9.943
小数点分隔符应该是 ',' 而不是 '.' 对于这个语言环境。错误在哪里?如何根据本地输出正确的小数分隔符?