How to convert binary code to text in VB.NET

1 Answer

0 votes
Imports System

Class Program
    Public Shared Function BinToText(ByVal binTxt As String) As String
        Dim text As String = ""

        For i As Integer = 0 To binTxt.Length - 1 Step 8
            Dim binaryChunk As String = binTxt.Substring(i, 8)
            Dim asciiValue As Integer = Convert.ToInt32(binaryChunk, 2)

            text &= Char.ConvertFromUtf32(asciiValue)
        Next

        Return text
    End Function

    Public Shared Sub Main(ByVal args As String())
        Dim binaryInput As String = "0101000001110010011011110110011101110010011000010110110101101101011010010110111001100111"
	
        Dim textOutput As String = BinToText(binaryInput)
	
        Console.WriteLine(textOutput)
    End Sub
End Class


' run:
'
' Programming
'

 



answered Apr 14, 2025 by avibootz

Related questions

...