012*_*346 3 iphone xcode hex nsstring nsdata
请检查这里是我的代码
int asciiCode = @"29 78 D8 BB 35 12 63 D5 C3 4B 18 D5 52 6B C2 83";
NSString *strings = [NSString stringWithFormat:@"%c", asciiCode];
NSLog(@"%c",strings);
}
Run Code Online (Sandbox Code Playgroud)
如果值为29 78 D8 BB 35 12 63 D5 C3 4B 18 D5 52 6B C2 83它应显示为india是我的字符串值,但它显示为)xÿª5c'√K'Rk¬É
int asciiCode = @"29 78 D8 BB 35 12 63 D5 C3 4B 18 D5 52 6B C2 83";
Run Code Online (Sandbox Code Playgroud)
这是无效的.@"..."是NSString,而不是int.
你可以有一个char数组,如下所示:
char *asciiCode = {0x29, 0x78, 0xD8, 0xBB, ...}
Run Code Online (Sandbox Code Playgroud)
您可以使用哪个变成NSString
NSString *strings = [NSString stringWithCString:asciiCode usingEncoding:NSUTF8StringEncoding];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
183 次 |
| 最近记录: |