当前位置: 代码迷 >> PB >> 下列VB的代码怎么改为PB的代码
  详细解决方案

下列VB的代码怎么改为PB的代码

热度:132   发布时间:2016-04-29 09:24:52.0
下列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码的事情.
------解决方案--------------------
C# code
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
------解决方案--------------------
C# code
//函数功能:取字符串 ls_s 对应的十六进制串string ls_s = "你好"char src[]Integer ln Integer istring stInteger temp//ln = 100 //这个不要,for循环中用upperbound来取上限//加一句,对src进行赋值src = ls_sFor 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)Nextmessagebox('',st) //“你好”对应的十六进制为“C4E3BAC3”
  相关解决方案