下列VB的代码如何改为PB的代码
dim src() As Byte
dim ln As Integer)
Dim i As Integer
Dim st As String
Dim temp As Integer
ln = 100
For i = 0 To ln - 1
temp = src(i) \ 16
If temp > 9 Then
temp = temp + 55
Else
temp = temp + 48
End If
st = st & Chr(temp)
temp = src(i) Mod 16
If temp > 9 Then
temp = temp + 55
Else
temp = temp + 48
End If
st = st & Chr(temp)
Next
[解决办法]
你用中文翻译一下呢?
貌似是个循环求ascii码的事情.
[解决办法]
Arry src()
Integer ln,i,temp
String st
ln = 100
For i = 0 To ln - 1
temp = src(i) \ 16
If temp > 9 Then
temp = temp + 55
Else
temp = temp + 48
End If
st = st & Char(temp) --?
temp = src(i) Mod 16
If temp > 9 Then
temp = temp + 55
Else
temp = temp + 48
End If
st = st & Chr(temp) ---?
Next
//函数功能:取字符串 ls_s 对应的十六进制串
string ls_s = "你好"
char src[]
Integer ln
Integer i
string st
Integer temp
//ln = 100 //这个不要,for循环中用upperbound来取上限
//加一句,对src进行赋值
src = ls_s
For i = 1 To upperbound(src)
temp = asc(src[i]) / 16
If temp > 9 Then
temp = temp + 55
Else
temp = temp + 48
End If
st = st + char(temp)
temp = Mod(asc(src[i]), 16)
If temp > 9 Then
temp = temp + 55
Else
temp = temp + 48
End If
st = st + Char(temp)
Next
messagebox('',st) //“你好”对应的十六进制为“C4E3BAC3”