天枫常用的ASP函数封装如下(2)
rep.Global=true
rep.IgnoreCase=true
rep.Pattern="[\u4E00-\u9FA5\uF900-\uFA2D]"
For each i in rep.Execute(str)
lens=lens+1
Next
Set Rep=Nothing
lens=lens + len(str)
strLength=lens
End Function
'****************************************************
'函数名:CutStr
'作 用:字符串长度切割,超过显示省略号
'参 数:str ----字符串内容
' strlen ------要显示的长度
'返回值:切割后字符串内容
'****************************************************
Public Function CutStr(str,strlen)
Dim l,t,i,c
If str="" Then
cutstr=""
Exit Function
End If
str=Replace(Replace(Replace(Replace(Replace(str," "," "),""",Chr(34)),">",">"),"<","<"),"|","|")
l=Len(str)
t=0
For i=1 To l
c=Abs(Asc(Mid(str,i,1)))
If c>255 Then
t=t+2
Else
t=t+1
End If
If t>=strlen Then
cutstr=Left(str,i) & "..."
Exit For
Else
cutstr=str
End If
Next
cutstr=Replace(Replace(Replace(Replace(replace(cutstr," "," "),Chr(34),"""),">",">"),"<","<"),"|","|")
End Function
'--------------系列验证----------------------------
'****************************************************
'函数名:CheckIsEmpty
'作 用:检查是否为空
'参 数:tstr ----字符串
'返回值:true不为空,false为空
'****************************************************
Public Function CheckIsEmpty(tstr)
CheckIsEmpty=false
If IsNull(tstr) or Tstr="" Then Exit Function
Dim Str,re
Str=Tstr
内容版权声明:除非注明,否则皆为本站原创文章。