I have a float number in which i insert comma after thousands value it works fine
NSNumberFormatter *formatter = [NSNumberFormatter new];
[formatter setNumberStyle:NSNumberFormatterDecimalStyle]; // this line is important!
NSString *formatted = [formatter stringFromNumber:[NSNumber numberWithFloat:appDelegate.C_WND_ClinInf_Average_Default]];
but it shows 1,947 but i want it to show 1,947.00 any idea how to formate like this.
Thanks
Have you tried using -setMaximumFractionDigits from NSNumberFormatter?
So, try something like:
[formatter setMaximumFractionDigits:2];
[formatter setMinimumFractionDigits:2];
This way you deal with NSNumberFormatter only and don't need to call anything extra on NSString.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With