'参数说明: 'strWord:需要截取的字符串 'numByte:整数,截取的总长度 'numDot:整数,如果被截取是否以“.”结尾,0为不需要,其他数值为“.”的个数 Function FixString(ByVal strWord, ByVal NumByte, ByVal NumDot) Dim i Dim lenWordByte FixString = "" If IsNull(strWord) or strWord = "" Then Exit Function lenWordByte = 0 For i = 1 to Len(strWord) If Asc(Mid(strWord, i, 1)) < 0 or Asc(Mid(strWord, i, 1)) > 255 Then lenWordByte = lenWordByte + 2 Else lenWordByte = lenWordByte + 1 End If If lenWordByte > NumByte Then Exit For FixString = FixString & Mid(strWord, i, 1) Next FixString = FixString & String(NumDot, ".") End Function