[sourcecode language="Objc"]
enum { // number format styles
kCFNumberFormatterNoStyle = 0,
kCFNumberFormatterDecimalStyle = 1,
kCFNumberFormatterCurrencyStyle = 2,
kCFNumberFormatterPercentStyle = 3,
kCFNumberFormatterScientificStyle = 4,
kCFNumberFormatterSpellOutStyle = 5
};
typedef CFIndex CFNumberFormatterStyle;
- (NSString *)replaceCurrency:(int)price {
NSLocale* locale = [[NSLocale alloc] initWithLocaleIdentifier:@"ko_KR"];
NSDecimalNumber *someAmount = [NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%d",price]];
NSNumberFormatter *currencyFormatter = [[NSNumberFormatter alloc] init];
[currencyFormatter setNumberStyle:kCFNumberFormatterDecimalStyle];
[currencyFormatter setLocale:locale];
return [currencyFormatter stringFromNumber:someAmount];
}
[/sourcecode]