我有一個NSNumberFormatter,我試圖用來從NSNumber生成GBP(£)的整數。無論我嘗試使用哪種咒語,我都會得到兩位小數。我的代碼是:防止小數與NSNumberFormatter
NSNumberFormatter *fmtCurrency = [[[NSNumberFormatter alloc] init] autorelease];
[fmtCurrency setNumberStyle: NSNumberFormatterCurrencyStyle];
[fmtCurrency setGeneratesDecimalNumbers:FALSE];
[fmtCurrency setCurrencyCode:@"GBP"];
[fmtCurrency setCurrencySymbol:@"£"];
txtTotal.text = [fmtCurrency stringFromNumber: result.Bill ]; // this is an NSNumber
我想獲得的intValue將刪除小數部分 – sujith1406