我用下面的代码在Win2000英文平台下处理简体汉字,总是出错。
mStr = StrConv(src, vbFromUnicode)
......
Code = StrConv(mStr, vbUnicode)
改用以下代码后,在Win2000简体中文平台下处理,OK;但切换到英文平台时,还是出错,
为什么,有没有比较多平台下通用的处理方案?
mStr = StrConv(src, vbFromUnicode, &H804)
......
Code = StrConv(mStr, vbUnicode, &H804)
mStr = StrConv(src, vbFromUnicode)
......
Code = StrConv(mStr, vbUnicode)
改用以下代码后,在Win2000简体中文平台下处理,OK;但切换到英文平台时,还是出错,
为什么,有没有比较多平台下通用的处理方案?
mStr = StrConv(src, vbFromUnicode, &H804)
......
Code = StrConv(mStr, vbUnicode, &H804)
dim c as string
dim n as long
For j = 1 To len(str)
c = Asc(Mid(str, j, 1))
If c >= 0 And c < 128 Then
n = n + 1 '计算英文
Else
n = n + 2 '计算中文
End If
Next j
makelen=n
end sub