'计算字节长度
Function ByteLen(Str)
Dim Length
Length = 0
For i = 1 To Len(Str)
If (Asc(Mid(Str, i, 1)) < 0) Then
Length = Length + 2
Else
Length = Length + 1
End If
ByteLen = Length
Next
End Function
'按字节取得字符串左边部分字符
Function LeftByte(Str, Lens)
Dim Length
Length = 0
For i = 1 To Len(Str)
If (Asc(Mid(Str, i, 1)) < 0) Then
Length = Length + 2
Else
Length = Length + 1
End If
If Length = Lens Then
LeftByte = Left(Str, i)
Exit Function
ElseIf Length > Lens Then
LeftByte = Left(Str, i - 1)
Exit Function
End If
Next
End Function
[此贴子已经被作者于2005-5-10 8:46:36编辑过]