Public Function LenC(str As String) As Integer ' 取混合字符串的实际长度:一个汉字占二个字节长度,一个ASCII占一个字节长度 ' LenC("例ABCD") = 5 Dim abString() As Byte Dim i As Integer abString() = str For i = LBound(abString) To UBound(abString) Step 2 If abString(i + 1) > 0 Then LenC = LenC + 2 Else LenC = LenC + 1 Next i End Function