在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1.方法定义 /// <summary> /// 十进制转换 /// </summary> /// <param name="hexChar"></param> /// <returns></returns> public static int HexChar2Value(string hexChar) { switch (hexChar) { case "0": case "1": case "2": case "3": case "4": case "5": case "6": case "7": case "8": case "9": return Convert.ToInt32(hexChar); case "a": case "A": return 10; case "b": case "B": return 11; case "c": case "C": return 12; case "d": case "D": return 13; case "e": case "E": return 14; case "f": case "F": return 15; default: return 0; } } public int Hex2Ten(string hex) { int ten = 0; for (int i = 0, j = hex.Length - 1; i < hex.Length; i++) { ten += HexChar2Value(hex.Substring(i, 1)) * ((int)Math.Pow(16, j)); j--; } return ten; }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论