c#16进制转浮点数单精度类型:

string s = "4144147B";
MatchCollection matches = Regex.Matches(s, @"[0-9A-Fa-f]{2}");
byte[] bytes = new byte[matches.Count];
for (int i = 0; i < bytes.Length; i++)
  bytes[i] = byte.Parse(matches[i].Value, System.Globalization.NumberStyles.AllowHexSpecifier);
float m = BitConverter.ToSingle(bytes.Reverse().ToArray(), 0);
Console.WriteLine(m);

 

相关文章:

  • 2021-10-12
  • 2022-12-23
  • 2021-10-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2022-01-01
猜你喜欢
  • 2022-12-23
  • 2021-04-22
  • 2022-12-23
  • 2021-12-10
  • 2021-08-15
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案