开发者

Convert integer to string and use each character

开发者 https://www.devze.com 2023-02-01 03:32 出处:网络
How is an integer converted to a string开发者_开发百科 in objective c and how is each character of the string reached?

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

精彩评论

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