//函數功能:取字符串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”
摘自 yyoinge的專欄