ByVal strWord,----值
ByVal intByteLength,------长度
ByVal intPadDotAmount- 。。。。。的多少
Function FixString(ByVal strWord, ByVal intByteLength, ByVal intPadDotAmount)
If strWord > "" Then
If Length(strWord) <= intByteLength Then
FixString = strWord
Else
Dim i
Dim intLength
Dim strChar
Dim bytChar
intLength = 0
For i = 1 to Len(strWord)
strChar = Mid(strWord, i, 1)
bytChar = Asc(Mid(strWord, i, 1))
If bytChar < 0 or bytChar > 255 Then
intLength = intLength + 2
Else
intLength = intLength + 1
End If
If intLength > intByteLength Then Exit For
FixString = FixString & strChar
Next
FixString = FixString & String(intPadDotAmount, ".")
End If
Else
FixString = ""
End If
End Function
'计算字符串单字节长度
Function Length(ByVal strWord)
If strWord > "" Then
Dim i, bytChar
Length = 0
For i = 1 to Len(strWord)
bytChar = Asc(Mid(strWord, i, 1))
If bytChar < 0 or bytChar > 255 Then Length = Length + 2 Else Length = Length + 1
Next
Else
Length = -1
End If
End Function