C#-获取字符的GBK编码值


public static int GetGBKValue(string key)
 {
            byte[] gbk = Encoding.GetEncoding("GBK").GetBytes(key);
            string code = "";
            foreach (byte b in gbk)
            {
                code += string.Format("{0:X2}", b);
            }
            int gbkValue = int.Parse(code, NumberStyles.HexNumber);
            return gbkValue;
 }

原文地址:https://www.cnblogs.com/liguobao/p/8169098.html