<%
'asp将二进制转十进制,使用方法:cDec(11010)
function cDec(num)
cDecstr=0
if len(num)>0 and isnumeric(num) then
for inum=0 to len(num)-1
cDecstr=cDecstr+2^inum*cint(mid(num,len(num)-inum,1))
next
end if
cDec=cDecstr
end function
'asp将二进制转八进制,使用方法:BcO(010110)
function BcO(num)
BcO=Oct(cDec(num))
end function
'asp将八进制转二进制,使用方法:OcB(26)
function OcB(num)
OcBstr=""
if len(num)>0 and isnumeric(num) then
for i=1 to len(num)
select case (mid(num,i,1))
case "0" OcBstr=OcBstr&"000"
case "1" OcBstr=OcBstr&"001"
case "2" OcBstr=OcBstr&"010"
case "3" OcBstr=OcBstr&"011"
case "4" OcBstr=OcBstr&"100"
case "5" OcBstr=OcBstr&"101"
case "6" OcBstr=OcBstr&"110"
case "7" OcBstr=OcBstr&"111"
end select
next
end if
OcB=OcBstr
end function
'八进制转十进制
function OcD(num)
OcD=cDec(OcB(num))
end function
'八进制转十六进制
function OcH(num)
OcH=Hex(OcD(num))
end function
%>