说坑,可能过头了,是我理所当然的把OC看作C了,
char* cstr = "zh中文12"; NSString* s = [NSString stringWithUTF8String:cstr]; NSLog(@"len = %d, %d", s.length,[s length]);
结果是6,6也就是说中文也当成1个字的。应该是因为
stringWithUTF8String的缘故
说坑,可能过头了,是我理所当然的把OC看作C了,
char* cstr = "zh中文12"; NSString* s = [NSString stringWithUTF8String:cstr]; NSLog(@"len = %d, %d", s.length,[s length]);
stringWithUTF8String的缘故