开发者

StringWithFormat min width

I know that this is possible, but can't seem to find it. I need to format a string (using stringWithFormat) with 3 0's when the value is <100.

So my integer i = 5, the string should be @"005", but 开发者_如何转开发I can't remember or find the format specifier to make this happen.

Hopefully this is low hanging fruit.

Thanks!


All I had to do was ask:

%03d works great.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜