转换十六进制字符串返回到烧焦 [英] Converting hex string back to char

查看:103
本文介绍了转换十六进制字符串返回到烧焦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道 - 有很多关于这个话题,但是,即使我也期待通过一群人想不出解决方案.. 我转换字符为十六进制是这样的:

I know- there are lots of topics concerning this, BUT even though I did look through a bunch of them couldn't figure the solution.. I'm converting char to hex like this:

char c = i;
int unicode = c;
string hex = string.Format("0x{0:x4}", unicode);

问:如何将十六​​进制为char回

Question: how to convert hex to char back?

推荐答案

您可以尝试:

hex = hex.Substring(2); // To remove leading 0x
int num = int.Parse(hex, NumberStyles.AllowHexSpecifier);
char cnum = (char)num;

这篇关于转换十六进制字符串返回到烧焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆