Binary Value of given number

Posted by Kerrigan on Fri 14 Mar 2003 09:46 AM — 1 posts, 11,384 views.

#0
i was wondering, that i havn't found any function in VBScript which can give me a binary representation of a given number. i've just found functions for hexadecimal and octal (Hex, Oct). Am i just to stupid to find this function ?

mmh, after i searched a while, i decided to make a little function for myself, maybe interesting for somebody else:

Function Bin(lngNumber)

Dim strBinary

strBinary = ""
While lngNumber > 0
If lngNumber Mod 2 = 0 Then
strBinary = "0" & strBinary
Else
strBinary = "1" & strBinary
End IF
lngNumber = lngNumber \ 2
Wend
Bin = strBinary

End Function

Maybe helpful, i just thought ;)

Kerrigan