--UTF8String const char *cString = [string UTF8String]; --cStringUsingEncoding: const char *cString = [string cStringUsingEncoding:NSUTF8StringEncoding]; --getCString:maxLength:encoding: char cStringPtr[string.length * 3 + 1]; memset(cStringPtr, 0, sizeof(cStringPtr)); [string getCString:cStringPtr maxLength:sizeof(cStringPtr) encoding:NSUTF8StringEncoding];2,char* 转 NSString
----initWithUTF8String: NSString *string = [[NSString alloc] initWithUTF8String:cString]; ----initWithCString:encoding: NSString *string = [[NSString alloc] initWithCString:cString encoding:NSUTF8StringEncoding];
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)