Function LeftEx(str,lennum)
Dim p_num
Dim i
If Len(str)<=lennum Then
LeftEx=str
Else
p_num=0
x=0
Do While Not p_num > lennum-1
x=x+1
If asc(mid(str,x,1))<0 Then
p_num=int(p_num) + 2
Else
p_num=int(p_num) + 1
End If
LeftEx=left(trim(str),x)&"…"
Loop
End If
End Function
Dim p_num
Dim i
If Len(str)<=lennum Then
LeftEx=str
Else
p_num=0
x=0
Do While Not p_num > lennum-1
x=x+1
If asc(mid(str,x,1))<0 Then
p_num=int(p_num) + 2
Else
p_num=int(p_num) + 1
End If
LeftEx=left(trim(str),x)&"…"
Loop
End If
End Function
博客给出了Function LeftEx函数的代码。该函数用于对字符串进行处理,若字符串长度小于等于指定长度则直接返回原字符串,否则按规则截取并添加省略号。
167

被折叠的 条评论
为什么被折叠?



