pb字符串转换为16进制串
栏目:sybase时间:2014-03-14 15:37:28
//函数功能:取字符串ls_s 对应的十六进制串
string ls_s = "你好"
char src[]
Integer ln
Integer i
string st
Integer temp
//ln = 100 //这个不要,自学教程,5自学网,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”
摘自 yyoinge的专栏
------分隔线----------------------------
------分隔线----------------------------