Function HexToInt( HexStr$ )
Local n=0, tmp$=HexStr.Trim().ToUpper()
For Local i=0 Until tmp$.Length
If tmp[i]>47 And tmp[i]<58 Then n=(n Shl 4)+tmp[i]-48 ElseIf tmp[i]>64 And tmp[i]<71 Then n=(n Shl 4)+tmp[i]-55 Else Return n
Next
Return n
End Function
BMaxified and optimized :)