问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/4541616/convert-integer-to-string-and-use-each-character