<% Function DBC2SBC(Str, flag)
rem 全角半角转换函数
rem flag=-1时进行半角转全角
rem flag=0时进行半角全角互转
rem flag=1时进行全角转半角
Dim i, sStr If Len(Str)<= 0 Then Exit Function DBC2SBC = "" For i = 1 To Len(Str) sStr = Asc(Mid(Str, i, 1)) Select Case flag Case -1 If sStr>0 And sStr<= 125 Then DBC2SBC = DBC2SBC & Chr(Asc(Mid(Str, i, 1)) -23680) Else DBC2SBC = DBC2SBC & Mid(Str, i, 1) End If Case 0 If sStr>0 And sStr<= 125 Then DBC2SBC = DBC2SBC & Chr(Asc(Mid(Str, i, 1)) -23680) Else DBC2SBC = DBC2SBC & Chr(Asc(Mid(Str, i, 1)) + 23680) End If Case 1 If sStr<0 Or sStr>125 Then DBC2SBC = DBC2SBC & Chr(Asc(Mid(Str, i, 1)) + 23680) Else DBC2SBC = DBC2SBC & Mid(Str, i, 1) End If End Select Next End Function %> |