本文介绍了将NSString转换为字节数组iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我想将NSString转换为Byte数组。
Hi I want to convert the NSString into Byte array.
如果我有像Hello这样的字符串,那么它会像这样转换成字节{65,23,56 ,56,56}。
if I have string like "Hello" then it convert into byte like this {65,23,56,56,56}.
谢谢
推荐答案
使用 - [NSString UTF8String]
返回 const char *
。阅读。
一般提示:如果您想查找某个类是否有某种方法,请查阅官方参考!我的意思是,在网络上,不仅有Stack Overflow,还有API提供商(即Apple或Microsoft的)官方文件!
A general tip: if you want to find if a class has a method which does something, look up the official reference! I mean, on the web, there's not only Stack Overflow, but the API provider's (i.e. Apple's or Microsoft's) official documentations!
这篇关于将NSString转换为字节数组iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!