I have a simple loop which is matching the letters and giving the equivalent into binary. Forexample I have a sequence of letters as abc, then according to the code given below the binary generated will be 000010001000011 and saved in the variable at the end.
What I want to have is the inverted output e.g. binary output converted from 000010001000011 (abc) to 000110001000001 (cba).
Can anyone please help me with this piece of code?
For i = 0 To stringlength - 1
If c = "0" Then
convertdata = "00000"
ElseIf c = "a" Then
convertdata = "00001"
ElseIf c = "b" Then
convertdata = "00010"
ElseIf c = "c" Then
convertdata = "00011"
ElseIf c = "d" Then
convertdata = "00100"
ElseIf c = "e" Then
convertdata = "00101"
ElseIf c = "f" Then
convertdata = "00110"
ElseIf c = "g" Then
convertdata = "00111"
ElseIf c = "h" Then
convertdata = "01000"
ElseIf c = "i" Then
convertdata = "01001"
ElseIf c = "j" Then
convertdata = "01010"
ElseIf c = "k" Then
convertdata = "01011"
ElseIf c = "l" Then
convertdata = "01100"
ElseIf c = "m" Then
convertdata = "01101"
ElseIf c = "n" Then
convertdata = "01110"
ElseIf c = "o" Then
convertdata = "01111"
ElseIf c = "p" Then
convertdata = "10000"
ElseIf c = "q" Then
convertdata = "10001"
ElseIf c = "r" Then
convertdata = "10010"
ElseIf c = "s" Then
convertdata = "10011"
ElseIf c = "t" Then
convertdata = "10100"
ElseIf c = "u" Then
convertdata = "10101"
ElseIf c = "v" Then
convertdata = "10110"
ElseIf c = "w" Then
convertdata = "10111"
ElseIf c = "x" Then
convertdata = "11000"
ElseIf c = "y" Then
convertdata = "11001"
ElseIf c = "z" Then
convertdata = "11010"
ElseIf c = "1" Then
convertdata = "11011"
ElseIf c = "2" Then
convertdata = "11100"
ElseIf c = "3" Then
convertdata = "11101"
ElseIf c = "4" Then
convertdata = "11110"
Else
convertdata = "11111"
End If
converted_data &= convertdata
Next
Regards,
Bilal A. Khan