NSString和std::string之间的转换

1----NSString转std::string

NSString  * nsfaceName=@"HELLO";

const char  *  lpfaceName = [nsfaceName UTF8String];

std::string   strFaceName=  [nsfaceName UTF8String];
 

2----std::string转NSString


std::string _string("hello");

NSString *str= [NSString stringWithCString:_string.c_str() encoding:[NSString defaultCStringEncoding]];

 

你可能感兴趣的:(Cocos2d-x,C++,OC字符串转换)