Jump to content
Sign in to follow this  

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)


Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.