0
numberFormatter = [[NSNumberFormatter alloc] init];
numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;    
NSLog(_priceTF.text);
NSNumber *price = [numberFormatter numberFromString:_priceTF.text];
NSLog([price stringValue]);

Console output: 25 kr

P.S. : price is nil.

4

1 回答 1

0

Currently, I get NSNumber so (but that's weird):

NSString *priceNoCurrency = [_priceTF.text stringByReplacingOccurrencesOfString:numberFormatter.currencySymbol withString:@""];
NSNumber *price = @(priceNoCurrency.integerValue);
于 2012-09-18T16:33:03.117 回答