我也来一个十六进制字符串转十进制数
 - (defun hex2dec(hex / map lst len p)
- (setq map '(48 49 50 51 52 53 54 55 56 57 65 66 67 68 69 70))
- (setq lst (mapcar '(lambda(x)(vl-position x map)) (vl-string->list (strcase hex))))
- (setq len (length lst))
- (setq p 0)
- (if (< len 8)
- (apply '+ (mapcar '(lambda(x)(lsh x (* 4 (- len (setq p (1+ p)))))) lst))
- "最多转7位16进制字符串"
- )
- )
|