통화 문자열을 10 진수 값으로 변환하도록 숫자 포맷터를 설정했습니다. 문제는 텍스트 문자열에 선행 달러 기호 ("$")가 없으면 유효한 일치하는 숫자가 아닌 0으로 변환된다는 것입니다. 그래서 :"0"을 반환하지 않는 Cocoa NSNumberFormatterCurrencyStyle
// formatter to convert a value to and from a currency string
NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init];
[currencyFormatter setNumberStyle:NSNumberFormatterCurrencyStyle];
[currencyFormatter setGeneratesDecimalNumbers:YES];
내가 뭔가를 놓치고 있습니까 :
여기"$3.50" converts to 3.50
"3.50" converts to 0
는 컨버터의 코드는?