Use NSNumberFormatter to format numeric data into a localized string representation.
int aNum = 60000; NSString *display = [NSNumberFormatter localizedStringFromNumber:@(aNum) numberStyle:NSNumberFormatterCurrencyStyle];
With this, you will receive $ 60,000.00
after that you can remove the $ sign and the '.' (decimal) by doing this.
NSString *Str = [display stringByReplacingOccurrencesOfString:@"$" withString:@""]; NSString *Str1 = [Str stringByReplacingOccurrencesOfString:@"." withString:@""]; NSString *newString = [Str1 substringToIndex:[Str1 length]-1]; NSString *newString1 = [newString substringToIndex:[newString length]-1];
'newString1' will provide you with the desired result.
Vineet singh
source share