Jump to content

UDF _HexLen


Recommended Posts

i thougth this could be usefull for someone

Func _HexLen($Number)
    If Not IsNumber($Number) Then
        Return 0
    ElseIf $Number = 0 Then
        Return 1
        If $Number < 0 Then $Number = $Number * -1
        Return Int(Log($Number)/Log(16))+1


$aNumber = Random(1, 1000);you dont know the value of $aNumber and so you dont know the second parameter for the Hex-function
$Hex = Hex($aNumber, _HexLen($aNumber))
MsgBox(0, "Example for " & $aNumber, $Hex)

you can modify this with replacing the 16 in line 9 with a 2 for calculating the length of a binary number (just for example)


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

  • Recently Browsing   0 members

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