In fact, this method to limit the number of words there are defects, that is, in the interception, English mixed words, English also intercepted by a word
The following is a modified function, for the landlord reference
The calling method does not change
function Setlen (Str,howlong)
If str= "" Then
Leftstr= ""
Exit function
End If
Dim l,t,c, I
Str=replace (replace (replace (str, "", ""), "", CHR), ">", ">"), "<", "<")
L=len (str)
T=0
For I=1 to L
C=abs (ASC (str,i,1))
If c>255 Then
T=t+2
Else
T=t+1
End If
If T>=howlong Then
Leftstr=left (str,i) & "..."
Exit For
Else
Leftstr=str
End If
Next
Leftstr=replace (replace (replace (LEFTSTR, "", ""), Chr (+), "" ")," > "," > ")," < "," < ")
End Function
Public Function cutstr (str, number)
Dim length, Llen, I, value
Dim tmp
TMP = str
If isNull (tmp) Then tmp = ""
Length = Len (TMP)
Llen = 0
For i = 1 to length
Value = ASCW (Mid (TMP, I, 1))
If value >= -127 and value <= 127 Then
Llen = Llen + 1
Else
Llen = Llen + 2
End If
' DebugPrint (Mid (TMP, I, 1) & ": & Value &"--"& Llen)
If Llen >= number-3 Then
Cutstr = Left (tmp, i) & "..."
Exit Function
End If
Next
CUTSTR = tmp
End Function