Converting currency string into NSDecimalNumber
问题 I'm trying to convert some currency string (e.g., $25,000) into NSDecimalNumber using the following code: NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init]; [currencyFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; [currencyFormatter setGeneratesDecimalNumbers:TRUE]; [currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; // textField.text is some currency string (e.g., $25,000) NSDecimalNumber *decimalNumber = [currencyFormatter numberFromString