|
使用方法:chkGB("Access中国")
返回:英英英英英英简简
Private Function chkGb(strGB As String) As String
On Error Resume Next
Dim ByteGB() As Byte
Dim ByteTemp(1) As Byte
Dim leng As Long, idx As Long
Dim Offset As Long
Dim strResult As String
ByteGB = StrConv(strGB, vbFromUnicode)
leng = UBound(ByteGB)
idx = 0
Do While idx <= leng
ByteTemp(0) = ByteGB(idx)
ByteTemp(1) = ByteGB(idx + 1)
Offset = GBOffset(ByteTemp)
If (Offset >= 0) And (Offset <= 8177) Then
strResult = strResult & "简"
idx = idx + 2
Else
strResult = strResult & "英"
idx = idx + 1
End If
Loop
chkGb = strResult
End Function
Private Function GBOffset(ChrString() As Byte) As Long
Dim Dl, Dh
Dl = ChrString(0)
Dh = ChrString(1)
GBOffset = (Dl - 161) * 94 + (Dh - 161)
End Function
|
|