Hex2Bin

Converts Hex to Binary

<%
Function Hex2Bin(hexvalue)
dim i, s, ilen, value, values
Set values = Server.CreateObject("Scripting.Dictionary")
' For non-ASP code, remove "Server." from above line
values.Add "0", "0000"
values.Add "1", "0001"
values.Add "2", "0010"
values.Add "3", "0011"
values.Add "4", "0100"
values.Add "5", "0101"
values.Add "6", "0110"
values.Add "7", "0111"
values.Add "8", "1000"
values.Add "9", "1001"
values.Add "A", "1010"
values.Add "B", "1011"
values.Add "C", "1100"
values.Add "D", "1101"
values.Add "E", "1110"
values.Add "F", "1111"
value = NULL
s = UCase(hexvalue)
if IsHex(s) then
value = ""
ilen = Len(s)
for i = 1 to ilen
value = value & values(Mid(s, i, 1))
next
end if
values.RemoveAll
Set values = NOTHING
Hex2Bin = value
End Function
%>

hexvalue

Views 969 Downloads 336

''

JeffSmith
26
Math Classic ASP
Revisions

v1.0