Converts Binary to Integer
Function Bin2Int(binvalue)
dim i, s, v, neg, ilen, value
value = NULL
if IsBin(binvalue) then
value = 0
s = binvalue
ilen = Len(s)
if (ilen=32) then
v = Left(s, 1)
neg = (cByte(v) = 1)
if neg then
s = BinNot(s)
end if
end if
s = StrReverse(s)
for i = 1 to ilen
value = value + CByte(Mid(s, i, 1)) * Power(2, i-1)
next
if neg then
value = -(value + 1)
end if
end if
Bin2Int = value
End Function
dim i, s, v, neg, ilen, value
value = NULL
if IsBin(binvalue) then
value = 0
s = binvalue
ilen = Len(s)
if (ilen=32) then
v = Left(s, 1)
neg = (cByte(v) = 1)
if neg then
s = BinNot(s)
end if
end if
s = StrReverse(s)
for i = 1 to ilen
value = value + CByte(Mid(s, i, 1)) * Power(2, i-1)
next
if neg then
value = -(value + 1)
end if
end if
Bin2Int = value
End Function
binvalue
Views 5,354
Downloads 1,492
CodeID
DB ID
ANmarAmdeen
610
Revisions
v2.0
Thursday
September
27
2018