iPhone4 iOS5 如何以编程方式将字符串转换为二进制字符代码?
我想知道如何获取一个字符并将其转换为二进制字符串。
假设我有一个string :
NSString* test = @"Test";
如何按从左到右的顺序将该字符串打印为每个字符的 ASCII 二进制代码:
T = decimal 84 = binary 1010100
e = decimal 101= binary 1100101
然后我想打印所有字符代码的总和序列
NSString binaryTest = @"10101001100101...";
Possible Duplicate:
Convert NSString to ASCII Binary Equivilent (and then back to an NSString again)
I would like to know how I can get a character and convert it to binary string.
Let's say I have a string :
NSString* test = @"Test";
How can I print this string as an ASCII binary codes for each character in order from left to right:
T = decimal 84 = binary 1010100
e = decimal 101= binary 1100101
I then want to print the sum sequence of all character codes
NSString binaryTest = @"10101001100101...";
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这应该做你想要的:
This should do what you want: