I have double number in a format like 34.123456789. How can I change it to 34.123?
34.123456789
I just want 3 digits after the decimal point.
The approved solution has a small typo. It's missing the "%".
Here is the solution without the typo and with a little extra code.
double d = 1.23456; NSString* myString = [NSString stringWithFormat:@"%.3f",d];
myString will be "1.234".