Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Hex to Decimal Conversion

 Keywords:  Hex Decimal conversion xHex

This UDF is nice for Hex to Decimal conversions when one does not wish the additional baggage of the WILX extender.
#DefineFunction Hex2Dec(hex)
   str="0123456789ABCDEF"
   hex=StrTrim(StrUpper(hex))
   hexlen=StrLen(hex)
   dec=0
   for x=1 to hexlen
       dec=(dec*16) + StrIndex(str,strsub(hex,x,1),0,@fwdscan) -1
   next
   return(dec)
#EndFunction


;Example Usage
a="07D0"
b=Hex2Dec(a)
Message(a,b)





Article ID:   W14751
Filename:   Hex to Decimal Conversion.txt