110,534
社区成员
发帖
与我相关
我的任务
分享
if ((hexString.Length % 2) != 0)
hexString += " ";
int count = hexString.Length;//8
public static byte[] strToHexByte(string hexString)
{
hexString = "abcd5d0e";
byte[] returnBytes = new byte[(int)Math.Ceiling(hexString.Length / 2.0)];
for (int i = 0; i < returnBytes.Length; i++)
returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, (i * 2 == hexString.Length - 1) ? 1 : 2), 16);
return returnBytes;
}