Search code examples
iphoneintegerintnslog

How to represent an integer with multiple digits? e.g represent 1 as 01


How could I NSLog/Output to a label an integer such as 7 as 07 rather than just 7?

I've tried %ii and %2i without success, and searched all over Google for a solution!

Surely there's a way to do it!?

Anyone? Thanks.


Solution

  • NSLog/printf format allows %02d.