- std::string转换为:NSString
string s = str("hello");;
NSString *str = [NSString stringWithCString:s.c_str() encoding:[NSString defaultCStringEncoding]];
2.NSString转换为std::string
NSString *str = @"hello";
string s = [str UTF8String];
string s = str("hello");;
NSString *str = [NSString stringWithCString:s.c_str() encoding:[NSString defaultCStringEncoding]];
2.NSString转换为std::string
NSString *str = @"hello";
string s = [str UTF8String];
本文标题:iOS中NSString与std::string互相转换
本文链接:https://www.haomeiwen.com/subject/cdolyctx.html
网友评论