Format string, integer with leading zeros

Posted by ghiboz on Stack Overflow See other posts from Stack Overflow or by ghiboz
Published on 2010-06-06T17:40:42Z Indexed on 2010/06/06 17:42 UTC
Read the original article Hit count: 372

Hi all! I Use this code:

NSString* strName = [NSString stringWithFormat:@"img_00%d.jpg", pp];

and works fine, but if pp took the value of 10 for example I wish have img_010.jpg as result, and not img_0010.jpg... how can I format the string??

thanks

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c