VB代码<%
'第一个函数
Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function '第二个函数
Function Unicode2Chr(byval str)
Dim st, t, i
For i = 1 To Len(str)/4
t = Mid(str, 4*i-3, 4)
't = Mid(t, 3) & Left(t, 2)
t = ChrW(Hex2Dec(t))
st = st & t
Next
Unicode2Chr = st
End Function'第三个函数
Function Hex2Dec(byval str)
Dim i, j, k, result
result = 0
For i = 1 To Len(str)
Select Case Mid(str, i, 1)
Case "f": j = 15
Case "e": j = 14
Case "d": j = 13
Case "c": j = 12
Case "b": j = 11
Case "a": j = 10
Case Else: If Mid(str, i, 1) <= "9" And Mid(str, i, 1) >= "0" Then j = CInt(Mid(str, i, 1))
End Select
For k = 1 To Len(str) - i
j = j * 16
Next
result = result + j
Next
Hex2Dec = result
End Function'第四个函数
Function Chr2Unicode(byval str)
Dim st, t, i,t1
For i = 1 To Len(str)
t = Hex(AscW(Mid(str, i, 1)))
If (Len(t) < 4) Then
while (Len(t) < 4)
t = "0"&t
Wend
End If
t = Mid(t, 3) & Left(t, 2)
t1=mid(t,3,2)&mid(t,1,2)
st = st & t1
Next
Chr2Unicode = LCase(st)
End Function
%>
'第一个函数
Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function '第二个函数
Function Unicode2Chr(byval str)
Dim st, t, i
For i = 1 To Len(str)/4
t = Mid(str, 4*i-3, 4)
't = Mid(t, 3) & Left(t, 2)
t = ChrW(Hex2Dec(t))
st = st & t
Next
Unicode2Chr = st
End Function'第三个函数
Function Hex2Dec(byval str)
Dim i, j, k, result
result = 0
For i = 1 To Len(str)
Select Case Mid(str, i, 1)
Case "f": j = 15
Case "e": j = 14
Case "d": j = 13
Case "c": j = 12
Case "b": j = 11
Case "a": j = 10
Case Else: If Mid(str, i, 1) <= "9" And Mid(str, i, 1) >= "0" Then j = CInt(Mid(str, i, 1))
End Select
For k = 1 To Len(str) - i
j = j * 16
Next
result = result + j
Next
Hex2Dec = result
End Function'第四个函数
Function Chr2Unicode(byval str)
Dim st, t, i,t1
For i = 1 To Len(str)
t = Hex(AscW(Mid(str, i, 1)))
If (Len(t) < 4) Then
while (Len(t) < 4)
t = "0"&t
Wend
End If
t = Mid(t, 3) & Left(t, 2)
t1=mid(t,3,2)&mid(t,1,2)
st = st & t1
Next
Chr2Unicode = LCase(st)
End Function
%>
解决方案 »
- 当输入*时怎样转换成×
- VB 调用 VC带指针的DLL!请高手帮忙
- 如何逐个提取出一个目录下的每个文件名
- 怎么设置MDI子窗口的BorderStyle?
- combo应该如何使用这个控件!
- 这是怎么回事呀!
- 请问:如何读取webbrowser中的数据?回答满意送50分(在线等候)
- 救命呀~怎么读取access库里image字段的路径,里边存放的是图象路径~!~给高分呀`!
- 窗口通信的问题,怪怪怪!!!!!
- 如何在vb中调带指针的dll????(请原谅我在vb,vc++两个论坛重复发帖子)
- 点击listview控件里的列头ColumnHeaders问题。
- 请教如何用API实现TreeView+ListView中CHECKBOXES的标记
第二个函数是UNICODE转化为字符
第三个函数是16进制转化为10进制
2个函数是UNICODE转化为字符
3个函数是16进制转化为10进制
4个函数是返回字符在ascII表中对应16进制值