objective c - i want to clear 0 behind the decimals -


this question has answer here:

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

Popular posts from this blog

tcpdump - How to check if server received packet (acknowledged) -