If value is in million then the string should be .. miliion ..thousand ..hundred
.
I used this code but it showing million value in thousand, how to resolve this iss
It works for me.
#import <Foundation/Foundation.h>
int main(int argc, char *argv[]) {
@autoreleasepool {
//convert to words
NSString *wordNumber;
NSNumber *numberValue = @6453323; //needs to be NSNumber!
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle:NSNumberFormatterSpellOutStyle];
// [numberFormatter setNumberStyle:@"en_IN"];
[numberFormatter setLocale:[NSLocale currentLocale]]; // happen by default?
wordNumber = [numberFormatter stringFromNumber:numberValue];
NSLog(@"Answer: %@", wordNumber);
}
}
2014-06-11 09:51:35.472 Untitled[480:507] Answer: six million four hundred fifty-three thousand three hundred twenty-three