objective c - i want to clear 0 behind the decimals -
this question has answer here:
- how trim zeros after decimal point 8 answers
i have problem because want show digit isn't 0 such as
9 / 2 = 4.5 not 4.500000
8 / 3 = 2.666667
20 / 8 = 1.25 not 1.250000
is there code me?
try this:
float f = 4.500000f; nsstring *s = [nsstring stringwithformat:@"%g", f];
Comments
Post a Comment