1. 程式人生 > 其它 >帶字串空格的轉16進位制

帶字串空格的轉16進位制

技術標籤:關於程式

16進位制字串轉換成16進位制資料

 string[] hexValuesSplit = AllChar.TrimStart().TrimEnd().Split(' ');
 byte[] Bytes = new byte[hexValuesSplit.Length];
 for (int i = 0; i < hexValuesSplit.Length; i++)
 {
       Bytes[i] = Convert.ToByte(hexValuesSplit[i], 16);
 }
 

hexValuesSplit.Length 即為16進位制的長度