Convert an hex string to its decimal equivalentTag(s): Powerscript


[of_hex2long(as_hex) returns a long]
string ls_hex
integer i,length
long result = 0

length = len(as_hex)
ls_hex = Upper(as_hex)
FOR i = 1 to length
   result += &
     (Pos ('123456789ABCDEF', mid(ls_hex, i, 1)) * &
     ( 16 ^  ( length - i )  ))
NEXT
RETURN result
See this HowTo for long2hex conversion.
blog comments powered by Disqus