#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSString * str= @"abcdefghijklmn";
char ch = [str characterAtIndex:6];//提取下标为6的字符给ch
const char *cc = [str UTF8String];//转换成C字符串
printf("%c\n%s\n",ch,cc);
}
return 0;
}
-----------------------------
g
abcdefghijklmn
Program ended with exit code: 0 |