Jump to content

Hex to Decimal


Recommended Posts

Not built in, but you can feed the string from Hex() back into this func:

Func Hex2Dec($number)
  $len = StringLen($number)
  $number = StringUpper($number)
  $ret = 0
  $fac = 1
  For $i = $len To 1 Step -1
    $n = Asc(StringMid($number, $i, 1)) - 48
    If $n > 9 Then $n = $n - 7
    $ret = $ret + ($n * $fac)
    $fac = $fac * 16
  Next
  Return $ret
EndFunc

/EDIT: removed use of ^ operator: Jon, this is straight forward to do in C. :whistle:

Edited by tylo

blub

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...