MAFCurrencyFormatter formats currency values according to country ISO code. Formatted numerical values are delimited by colons or periods, depending on the ISO code, and the currency symbol (if any); or its alphabetical code is prefixed to the digits.
[MAFDefaultCurrencySettings loadCurrencies];
NSString* isoCode = @"HUF"; int decimals = [[MAFCurrencyCatalog currencyCatalog] decimalsByISO:isoCode]; MAFCurrencyFormatterSettings* settings = [[MAFCurrencyFormatterSettings alloc] initWithLength:18 andDecimalPlaces:decimals andFlags:CURRENCY_FORMATTER_FLAG_SIGNED | CURRENCY_FORMATTER_FLAG_ALLOWS_NULL];
MAFCurrencyFormatter* currencyFormatter = [[[MAFCurrencyFormatter alloc] initWithDecimalNumber:nil andSettings:settings andISOCurrencyCode:isoCode] autorelease]; [settings release]; // we do not need to hold a reference to the settings after setting it for the alloc/init
[currencyFormatter setValue:[NSDecimalNumber decimalNumberWithDecimal:[[NSNumber numberWithInt:1423196924] decimalValue]]]; NSLog(@"FORMATTED VALUE> %@", [currencyFormatter getFormattedValue]);This code shows the formatted currency value according to the Hungarian format:
FORMATTED VALUE> HUF1,423,196,924