开发者

Convert integer to string and use each character

How is an integer converted to a string开发者_开发百科 in objective c and how is each character of the string reached?

The equivalent to the java charAt() method.


NSString *myString = [NSString stringWithFormat:@"%i", 36];
[myString characterAtIndex:0]; //"3"
[myString characterAtIndex:1]; //"6"

Update: Note that characterAtIndex returns a unichar not a c char. Thanks @Chuck.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜