Copy Code code as follows:
'************************************
' Intercept literal length function, support UTF-8
' Input parameters:
' 1, text content
' 2, text maximum length
'************************************
Public Function Cut_title (Title,tlen)
Dim K,i,d,c
Dim ISTR
Dim Fortotal
If CDBL (Tlen) > 0 Then
K=0
D=strlen (Title)
Istr= ""
Fortotal = Len (Title)
For I=1 to Fortotal
C=abs (ASCW) (Mid (title,i,1))
If c>255 Then
K=k+2
Else
K=k+1
End If
Istr=istr&mid (title,i,1)
If CLng (k) >clng (Tlen) Then
Istr=istr "..."
Exit for
End If
Next
Cut_title=istr
Else
Cut_title= ""
End If
End Function
'*******************************
' Detect literal length function, support UTF-8
' Input parameters:
' 1, text content
'*******************************
Public Function StrLen (strText)
Dim K,i,c
Dim Fortotal
K=0
Fortotal = Len (StrText)
For I=1 to Fortotal
C=abs (ASCW) (Mid (strtext,i,1))
If c>255 Then
K=k+2
Else
K=k+1
End If
Next
Strlen=k
End Function