Goal C: How to get the Ascii Integer value of the first letter of NSString?
if ([aString length] > 0) { unichar firstCharacter = [aString characterAtIndex: 0]; // ... }
It's all. unicharis an alias unsigned shortand is also an integer type. However, there is no guarantee that a character is part of ASCII, as it is NSStringbased on Unicode.
unichar
unsigned short
NSString
unichar ch = [myString characterAtIndex: 0]
, , unichar unicode, typedef . NSString ASCII, ASCII, ASCII. , .
If you really need to do this, include the first character of the string in ASCII encoded NSData and then read it.
There's some help in the String Programming Guide .
Source: https://habr.com/ru/post/1779847/More articles:How to make a window in activity? - androidusing custom pfm / pfb fonts on my website - cssHow to add a simple image upload to a form? - phpc: music detection algorithm - bit - cNHibernate Validator Performance - nhibernatechar before ascii - Objective-C - objective-cThe easiest way to map data from double to integer without losing consistency - mathЕсть ли Java-класс, который может представлять собой любой объект Javascript? - javaPHP array array by reference - arrayscall performSelectorInBackground: from background theme - multithreadingAll Articles