【发布时间】:2014-02-04 06:41:30
【问题描述】:
我有十六进制表示 ascii 值,以以下格式存储。
// Hex reperesention of ascii string
string hexString = "48-65-6C-6C-6F-20-77-6F-72-6C-64-21-21-21";
// Could someone help fill in the blanks here?
private string hexConverter(string hexString)
{
string asciiCharString;
// Convert it
return asciiCharString;
}
所以当被调用时;
string s = hexConverter(hexString);
字符串 s 将包含“Hello world!!!”在这种情况下。
【问题讨论】:
-
您显示的代码不是解决此问题的尝试。您可以编辑您的帖子以反映您迄今为止的尝试吗?
-
C# hex to ascii 的可能重复项
-
拆分
-,通过十六进制字符串到字节转换器传递字符串,通过Encoding.ASCII.GetString()传递该字节数组,你就完成了 -
自己试试吧。提示:
string.Split、Convert.ToByte(string value, int fromBase)和Encoding.ASCII.GetString -
@Blam 不,这里重要的是数据的编码方式。对于给定的示例,可能是 ASCII、UTF8 等。