Module Module1
Public Function traduction_ASCII(trames As String)
Dim binario_en_8 As Integer = 0
Dim dec As Integer = 0
Dim Remainder As Integer
Dim result As String = ""
Dim j As Integer = 0
Dim tabular_binario(40) As String
'Modificamos los elementos ASCII en binarios'
For i = 0 To trames.Length - 1
'Recuperamos el valor numerica del ASCII leido en 8 bits'
binario_en_8 = Asc(trames.ElementAt(i))
'est esta necesario pero no se porque'
dec = Val(binaire_en_8)
'la modificamos en su valor ASCII en 6 bits'
dec = dec - 48
If dec > 40 Then
dec = dec - 8
End If
While dec > 0
remainder = dec Mod 2
dec /= 2
result = Remainder.ToString & result
j = j + 1
End While
While j < 6
result = "0" & result
j = j + 1
End While
tableau_binario(i) = result
result = ""
j = 0
Next
Return traduction_binaire_de_ASCII
End Function
End Module
Module Module1
Public Function traduction_ASCII(trames As String)
Dim binario_en_8 As Integer = 0
Dim dec As Integer = 0
Dim Remainder As Integer
Dim result As String = ""
Dim j As Integer = 0
Dim tabular_binario(40) As String
'Modificamos los elementos ASCII en binarios'
For i = 0 To trames.Length - 1
'Recuperamos el valor numerica del ASCII leido en 8 bits'
binario_en_8 = Asc(trames.ElementAt(i))
'est esta necesario pero no se porque'
dec = Val(binaire_en_8)
'la modificamos en su valor ASCII en 6 bits'
dec = dec - 48
If dec > 40 Then
dec = dec - 8
End If
While dec > 0
remainder = dec Mod 2
dec /= 2
result = Remainder.ToString & result
j = j + 1
End While
While j < 6
result = "0" & result
j = j + 1
End While
tableau_binario(i) = result
result = ""
j = 0
Next
Return traduction_binaire_de_ASCII
End Function
End Module