Bin2Int

Converts Binary to Integer

CodeFunctionName
What is this?

Public

Tested

Imported
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

binvalue

Views 5,350

Downloads 1,492

CodeID
DB ID