2# broly
实际上用u4e00-u9fa5区间来判断汉字是非常不准确的
其实在国内范围用判断字符高位是不是0x00的方法更为准确有效
见下面的代码示例:- Dim vbStr, Str, HexCode, OutStr1, OutStr2
- '提取汉字
- vbStr = "[精品展示]一个纯批处理备份&还原驱动"
- For i = 1 To Len(vbStr)
- Str = Mid(vbStr, i, 1)
- If Ascb(Midb(Str, 2, 1)) <> 0 Then
- OutStr1 = OutStr1 & Str
- HexCode = Hex(Ascb(Midb(Str, 2, 1))) & Hex(Ascb(Midb(Str, 1, 1)))
- If HexCode => "4e00" And HexCode <= "9fa5" Then OutStr2 = OutStr2 & Mid(vbStr, i, 1)
- End If
- Next
- MsgBox "高位判断法:" & OutStr1 & vbCrLf & "区间判断法:" & OutStr2
复制代码
|