std::string转NSString
std::string _string("hello"); NSString *str= [NSString stringWithCString:_string.c_str() encoding:[NSString defaultCStringEncoding]];
NSString转std::string
NSString * nsfaceName[email protected]"HELLO"; const char * lpfaceName = [nsfaceName UTF8String]; std::string strFaceName= [nsfaceName UTF8String];
- //NSString转换char
- NSString * str1= @"Test";
- const char * c1 =[str1 UTF8String];
- //char转换NSString
- const char * c2 ="test";
- NSString *str2 = [NSString stringWithUTF8String:c2];
char * string nsstring 之间的相互转换,布布扣,bubuko.com
时间: 2024-10-06 01:20:15