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

コンソール出力: 25 kr

PS : 価格はゼロです。

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 に答える