现在的位置: 首页 > 综合 > 正文

16进制数据 — 转换成中文

2013年09月15日 ⁄ 综合 ⁄ 共 484字 ⁄ 字号 评论关闭

string a = "0152656420616E540000000000000000000041006400000000000000095B5265445D4E614461000000000000000148016400000000000000";

            byte[] bytes = new byte[a.Length / 2];

            int i = 0,r = 0;           
            while (i < a.Length)
            {
                bytes[r] = byte.Parse(a.Substring(i, 2), System.Globalization.NumberStyles.HexNumber);
                i += 2;
                r++;
            }

            string s = System.Text.Encoding.Default.GetString(bytes);
            Console.WriteLine(s);

抱歉!评论已关闭.