adding zeros in objective-c string formats

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2011-01-15T01:23:57Z Indexed on 2011/01/15 1:53 UTC
Read the original article Hit count: 522

Hello-
Quick question: I am trying to fill in empty spaces with a specific number of zeroes in an NSString stringWithFormat formatting string.
For example, I want:

@"The number is %d", 5   // I want this to output 'the number is 05'
@"the number is %d", 10  // I want this to output 'the number is 10'

I know how to do this in Java, but I cant seem to find the same function in objective-c.

Any help would be great.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c