高分请教字符数据转换显示

haj77 2003-05-15 03:45:28
现在有一串字符 A="$1*q3esdf *~AEFSEF嘃%k4?€i" ,如何将它们一个个变成十六进制的数,比如 3B 4C 00 34 5D 6F A0 2B....... 并且将这些数显示出来ListBox
中,显示的为:3B 4C 00 34 5D 6F A0 2B....... ?
...全文
4 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
sxs69 2003-05-15
Private Sub Command2_Click()
Dim arr() As Byte
Dim i As Integer
Dim a As String
Dim s As String
a = "$1*q3esdf *~AEFSEF嘃%k4?€i"
arr = StrConv(a, vbFromUnicode)
For i = 0 To UBound(arr)
s = s & Hex(arr(i)) & " "
Next
List1.AddItem s
s = StrConv(arr, vbUnicode)
Text2 = s
End Sub
回复
rainstormmaster 2003-05-15
Private Sub Command1_Click()
A = "$1*q3esdf *~AEFSEF?%k4??€i?"
For iFor = 1 To Len(A)
b = Mid(A, iFor, 1)
List1.AddItem Hex(Asc(b))
Next iFor

End Sub

Private Sub Command2_Click()
s = ""
For i = 0 To List1.ListCount

s = s + Chr(Val("&H" & List1.List(i)))
Next
MsgBox s
End Sub
回复
monglihong 2003-05-15
同意MoQi_123(老莫的春天)
Dim strBuf as string
dim strHexBuf as string
dim i as long

strBuf=......
for i=1 to len(strbuf)
strhexbuf=strHexBuf & Hex(Asc(mid(strBuf,i,1))) & " "
next
me.text1.text=strhexbuf
回复
MoQi_123 2003-05-15
Dim strBuf as string
dim strHexBuf as string
dim i as long

strBuf=......
for i=1 to len(strbuf)
strhexbuf=strHexBuf & Hex(Asc(mid(strBuf,i,1))) & " "
next
回复
hulianchi 2003-05-15
dim strHex as string
dim strChr as string
dim intI as integer

for intI=1 to Len(A)
strChr=midb(strconv(A,vbFromUnicode),inti,1)
strHex=strHex & Hex(asc(strChr))
next inti

马上下班,没有测试,如有问题。再讨论!

回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7492

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2003-05-15 03:45
社区公告
暂无公告