NSString stringWithFormat Percent Sign

8.5k Views Asked by At

I searched and could not find this answer...

If I have this, how can I get it to display the final % symbol? It just omits it in my label.

[NSString stringWithFormat:@"Tries %i%", tries];
1

There are 1 best solutions below

0
Q8i On

I thought I could contribute a bit and share this comprehensive list of options. Jesse is right!

In my case, the following does the trick!

[NSString stringWithFormat:@"Progress: %.2f%%", progress*100] 
// progress is float ranging 0.0-1.0, 
//and I would like it to print up to 2 decimal point

Happy coding!