日期:2014-05-18 浏览次数:20643 次
string s = "477A45C2"; 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, NumberStyles.AllowHexSpecifier); float m = BitConverter.ToSingle(bytes, 0); Response.Write(m);