Mikon Posted August 10, 2005 Share Posted August 10, 2005 i thougth this could be usefull for someone Func _HexLen($Number) If Not IsNumber($Number) Then SetError(1) Return 0 ElseIf $Number = 0 Then Return 1 Else If $Number < 0 Then $Number = $Number * -1 Return Int(Log($Number)/Log(16))+1 EndIf EndFunc example: $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) Mikon Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now