Converting from hex to string

后端 未结 6 701
慢半拍i
慢半拍i 2020-11-27 04:44

I need to check for a string located inside a packet that I receive as byte array. If I use BitConverter.ToString(), I get the bytes a

6条回答
  •  隐瞒了意图╮
    2020-11-27 05:09

     string hexString = "8E2";
     int num = Int32.Parse(hexString, System.Globalization.NumberStyles.HexNumber);
     Console.WriteLine(num);
     //Output: 2274
    

    From https://msdn.microsoft.com/en-us/library/bb311038.aspx

提交回复
热议问题