numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
NSLog(_priceTF.text);
NSNumber *price = [numberFormatter numberFromString:_priceTF.text];
NSLog([price stringValue]);
控制台输出:25 kr
P.S。 :价格是零。
答案 0 :(得分:0)
目前,我得到了NSNumber(但这很奇怪):
NSString *priceNoCurrency = [_priceTF.text stringByReplacingOccurrencesOfString:numberFormatter.currencySymbol withString:@""];
NSNumber *price = @(priceNoCurrency.integerValue);