Binary To ASCII
This algorithm converts binary numbers to ASCII code.
Public Shared Function BinaryToASCII(bin As String) As String
Dim ascii As String = String.Empty
For i As Integer = 0 To bin.Length - 1 Step 8
ascii += ChrW(BinaryToDecimal(bin.Substring(i, 8)))
Next
Return ascii
End Function
Private Shared Function BinaryToDecimal(bin As String) As Integer
Dim binLength As Integer = bin.Length
Dim dec As Double = 0
For i As Integer = 0 To binLength - 1
dec += (CByte(AscW(bin(i))) - 48) * Math.Pow(2, ((binLength - i) - 1))
Next
Return CInt(Math.Truncate(dec))
End Function
Example
Dim data = "01010000011100100110111101100111011100100110000101101101011011010110100101101110011001110010000001000001011011000110011101101111011100100110100101110100011010000110110101110011"
Dim value = BinaryToASCII(data)
Output
Programming Algorithms