This is a start of a function to convert hex or oct to decmial
LPARAMETERS luValue, llisOCT
LOCAL lnRetVal, liBase, liStep, lcBuffer, liValue
lnRetVal = 0
liBase = 0
liStep = 0
lcBuffer = ""
liValue = 0
IF TYPE("luValue") = "N" OR TYPE("luValue") = "I"
llisOCT = .T.
luValue = TRANSFORM(luvalue)
ENDIF
liBase = IIF(llisOCT,8,16)
FOR liStep = 1 TO LEN(luValue)
lcBuffer = SUBSTR(luValue,liStep,1)
IF lcBuffer $ "ABCDEF"
liValue = 9 + AT(lcBuffer,"ABCDEF")
ELSE
liValue = VAL(lcBuffer)
ENDIF
lnRetVal = lnRetVal + (liValue *(liBase ^ (LEN(luValue) - liStep)))
ENDFOR
RETURN lnRetVal
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only