C#-获取字符的GBK编码值
2021-07-17 00:20
标签:div ret parse post bytes down return numbers markdown C#-获取字符的GBK编码值 标签:div ret parse post bytes down return numbers markdown 原文地址:https://www.cnblogs.com/liguobao/p/8169098.html
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;
}
下一篇:Promise API 简介