Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Hex to decimal conversion 1999-01-31 -- Lee White Not sure if this is what you're looking for...
Hex2Dec FUNCTION(? hString)
lVal LONG,AUTO
sPos BYTE,AUTO
Correction BYTE,AUTO
hCstring CSTRING(11),AUTO
CODE
hCstring = CLIP(hString)
lVal = 0
Correction = CHOOSE(UPPER(SUB(hCstring,-1,1)) = 'H',1,0)
LOOP sPos = 1 TO LEN(hCstring)-Correction
lVal = lVal*16+(INSTRING(hCstring[sPos],'0123456789ABCDEF',1,1))-1
END
RETURN(lVal)
Probably better ways but this should get you started.
Today is November 21, 2024, 3:59 am This article has been viewed 35204 times.
|
|