//16进制的数字的字符串表示形式转换为等效的byte数组
byte[] Base16StrToBytes(string strValues)
{
int len = strValues.Length / 2;
int remainder = strValues.Length % 2;
byte[] hexValues = new Byte[len + remainder];
for (int i = 0; i < len; i++)
{
hexValues[i] = Convert.ToByte(strValues.Substring(i * 2, 2), 16);
}
if (remainder != 0)
{
hexValues[len + remainder - 1] = Convert.ToByte(strValues.Substring(strValues.Length - 1, 1), 16);
}
return hexValues;
}
16进制的数字的字符串表示形式转换为等效的byte数组
最新推荐文章于 2024-09-09 15:34:44 发布