Kei*_*ler 0 objective-c cstring nsstring
我可以将NSMutableString转换为char*吗?
例如
NSString* someval = @"This is a test.";
NSMutableString *temp = [NSMutableSTring stringWithString:someval];
char * temp2 = ????Not sure what to do here???;
Run Code Online (Sandbox Code Playgroud)
使用-UTF8String方法:
NSString* someval = @"This is a test.";
NSMutableString *temp = [NSMutableString stringWithString:someval];
const char * temp2 = [temp UTF8String];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2054 次 |
| 最近记录: |