Convert NSString into byte array iphone

前端 未结 3 789
滥情空心
滥情空心 2021-01-19 04:10

Hi I want to convert the NSString into Byte array.

if I have string like \"Hello\" then it convert into byte like this {65,23,56,56,56}.

thanks

3条回答
  •  离开以前
    2021-01-19 04:44

    Use -[NSString UTF8String] which returns const char*. Read the reference.

    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!

提交回复
热议问题