( ?。?/div>
Dim s As String,ch As String
Dim result As String,chA As String,chB As String
‘’
‘’
Dim i As Integer,j As Integer
Dim n As Integer,m As Integer
s=Text1.Text
n=Len(s)
result=““:c=“0123456789ABCDEF“
For i=1To n
ch=①
D2B(Mid(s,i,1))
D2B(Mid(s,i,1))
ch=niXu(ch)
m=0
For j=1To 4'獲取二進(jìn)制碼前4位的值②
m=m*2+Val(Mid(ch,i,1))
m=m*2+Val(Mid(ch,i,1))
Next
chA=Mid(c,m+1,1)
m=0
For j=5To Len(ch)
m=m*2+Val(Mid(ch,j,1))
Next
chB=Mid(c,m+1,1)
result=result+chA+chB
Next
Text2.Text=result
End Sub
'得到單個(gè)字符ch的8位二進(jìn)制編碼
Function D2B(ByVal ch As String) As String
Dim s As String
Dim data As Integer,i As Integer
data=Asc(ch):s=““
Do While data>0
s=Str(data Mod 2)+s
data=data\2
Loop
If Len(s)<8Then
For i=1To 8-Len(s)
s=“0“+s
Next
D2B=s
Else
D2B=s
End If
End Function
'返回字符串s的逆序
Function niXu(ByVal s As String) As String
Dim i As Integer:Dim r As String
r=““
For i=Len(s) To 1Step-1
r=r+Mid(s,i,1)
Next
niXu=r
End Function.