iPhone - 将字符串转换为无符号字符

发布于 2024-11-26 17:23:50 字数 511 浏览 1 评论 0原文

我正在尝试从服务器解密字符串。

我想要以下部分中的字符串 -

unsigned char Cipher1[] = {My String};

我的字符串是

“194,75,26,184,223,124,164,170,161,213,135,46,160,5,82,46,56,44,244,116,37,2 0,181,65,49,243,172,203,32,188,168,54,46,207,126,14,111,24,39,131,185,13,​​58,105, 32,168,77,83,202,165,242,198,34,192,161,39,202,58,230,72,234,218,171,50,187,235 ,124,24,16,2,117,188,221,73,136,37,81,217,30,17,57,136,91,224,178,12,37,255"

如何解决这个问题。

提前致谢。

I am trying to decrypt a string from the server.

And I want the string in following part -

unsigned char Cipher1[] = {My String};

My string is

"194,75,26,184,223,124,164,170,161,213,135,46,160,5,82,46,56,44,244,116,37,20,181,65,49,243,172,203,32,188,168,54,46,207,126,14,111,24,39,131,185,13,58,105,32,168,77,83,202,165,242,198,34,192,161,39,202,58,230,72,234,218,171,50,187,235,124,24,16,2,117,188,221,73,136,37,81,217,30,17,57,136,91,224,178,12,37,255"

How to solve this issue.

thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

恋你朝朝暮暮 2024-12-03 17:23:50

试试这个:

const unsigned char *string = (const unsigned char *) [MyString UTF8String];

Try this:

const unsigned char *string = (const unsigned char *) [MyString UTF8String];
古镇旧梦 2024-12-03 17:23:50

如果您只是想将 NSString 转换为 char *,请使用 - (const char *)cStringUsingEncoding:(NSStringEncoding)encoding

const char *cipher1 = [myString cStringWithEncoding: NSUTF8StringEncoding];

If you're simply looking to convert an NSString to a char *, use - (const char *)cStringUsingEncoding:(NSStringEncoding)encoding

const char *cipher1 = [myString cStringWithEncoding: NSUTF8StringEncoding];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文