求vb中将字符串转换为16进制的ascii码
在Text1中输入,在Text2中输出,按Command1执行。输出例如“3A3372”,要求每个字都转到...
在Text1中输入,在Text2中输出,按Command1执行。输出例如“3A3372”,要求每个字都转到
展开
4个回答
推荐于2018-03-23
展开全部
Dim i As Integer
For i = 1 To Len(Text1)
Text2 = Text2 + Hex(Asc(Mid(Text1, i, 1)))
Next
'输入 百度 ,输出 B0D9B6C8
不知道是不是你要的
For i = 1 To Len(Text1)
Text2 = Text2 + Hex(Asc(Mid(Text1, i, 1)))
Next
'输入 百度 ,输出 B0D9B6C8
不知道是不是你要的
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Text2.Text = Hex(Asc(Text1.Text))
该死,这样不行.
该死,这样不行.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
For i = 1 To Len(Text1.Text)
n = jinzhizhuanh(Asc(Mid(Text1.Text, i, 1)))
jieguo = jieguo & n & " "
Next i
Text2.Text = jieguo
End Sub
Function jinzhizhuanh(n As Integer) As String
Dim a(15) As String
b = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f"
For i = 0 To 15
a(i) = Split(b, ",")(i)
Next i
Do While n > 15
s = Int(n / 16)
k = a(n - s * 16) & k
n = s
Loop
k = a(n) & k
jinzhizhuanh = k
End Function
For i = 1 To Len(Text1.Text)
n = jinzhizhuanh(Asc(Mid(Text1.Text, i, 1)))
jieguo = jieguo & n & " "
Next i
Text2.Text = jieguo
End Sub
Function jinzhizhuanh(n As Integer) As String
Dim a(15) As String
b = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f"
For i = 0 To 15
a(i) = Split(b, ",")(i)
Next i
Do While n > 15
s = Int(n / 16)
k = a(n - s * 16) & k
n = s
Loop
k = a(n) & k
jinzhizhuanh = k
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询