Equivalent of charCodeAt in Objective C
Good Morning All,
I have an Objective C question that is coming from JavaScript. I have a piece of code that is being run in JavaScript (code that I was handed) and it is running a critical conversion method that uses the .charCodeAt(SOME_CHARACTER)
JavaScript method to return th开发者_StackOverflow中文版e Unicode code associated with that specific character.
What I need to do is find the objective c method that does the same thing. I have tried searching through the NSString
and Unichar classes but didn't have any luck and I didn't find anything on here when I searched so I'm hoping someone could help me out.
Thanks!
Well, simply use the characterAtIndex:
method of NSString:
- (unichar)characterAtIndex:(NSUInteger)index
If I remember correctly, unichar is a typedef to two bytes (kind of short).
精彩评论