<% Function CutStr(Str,Gtype,lennum) Dim p_num Dim i,x If strlen(Str)<=lennum Then CutStr=str Else p_num=0 x=0 Do while not p_num > lennum-2 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 If Gtype = 1 Then CutStr=left(trim(str),x) & "..." Else CutStr="..." & Right(trim(str),x) End IF Loop End If End Function '取字符串长度 Function strlen(str) Dim p_len,xx p_len=0 strlen=0 If trim(str)<>"" Then p_len=len(trim(str)) For xx=1 to p_len If asc(mid(str,xx,1))<0 Then strlen=clng(strlen) + 2 Else strlen=clng(strlen) + 1 End If Next End If End Function function GetVariable(strVariableName) if IsEmpty(Request(strVariableName)) then GetVariable=empty exit Function end if GetVariable=Replace(Request(strVariableName),"'","''") GetVariable=Replace(GetVariable,";","") GetVariable=Replace(GetVariable,"--","") end function function GetFormVariable(strVariableName) if IsEmpty(Request.Form(strVariableName)) then GetFormVariable=empty exit Function end if GetFormVariable=Replace(Request.Form(strVariableName),"'","''") GetFormVariable=Replace(GetFormVariable,"--","") end function function GetQueryString(strVariableName) if IsEmpty(Request.QueryString(strVariableName)) then GetQueryString=empty exit Function end if GetQueryString=Replace(Request.QueryString(strVariableName),"'","''") GetQueryString=Replace(GetQueryString,";","") GetQueryString=Replace(GetQueryString,"--","") end function '===========================专门用来过滤Request的参数值=================================== Function CutStr(Str,Gtype,lennum) Dim p_num Dim i,x If strlen(Str)<=lennum Then CutStr=str Else p_num=0 x=0 Do while not p_num > lennum-2 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 If Gtype = 1 Then CutStr=left(trim(str),x) & "..." Else CutStr="..." & Right(trim(str),x) End IF Loop End If End Function '取字符串长度 Function strlen(str) Dim p_len,xx p_len=0 strlen=0 If trim(str)<>"" Then p_len=len(trim(str)) For xx=1 to p_len If asc(mid(str,xx,1))<0 Then strlen=clng(strlen) + 2 Else strlen=clng(strlen) + 1 End If Next End If End Function Function RemoveHTML(strHTML) Dim objRegExp, Match, Matches Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True '取闭合的<> objRegExp.Pattern = "<.+?>" '进行匹配 Set Matches = objRegExp.Execute(strHTML) ' 遍历匹配集合,并替换掉匹配的项目 For Each Match in Matches strHtml=Replace(strHTML,Match.Value,"") Next RemoveHTML=strHTML Set objRegExp = Nothing End Function function convert_old(str) dim tempStr tempStr = str&"" if tempStr = "" then tempStr = " " else tempStr=replace(tempStr,"'","’") tempStr=replace(tempStr,"""",""") tempStr=replace(tempStr," "," ") tempStr=replace(tempStr,"<","<") tempStr=replace(tempStr,">",">") tempStr=replace(tempStr,chr(13),"
") end if convert=tempStr End function function convert(str) dim re dim restr reStr = str&"" Set re=new RegExp re.IgnoreCase =true re.Global=True re.Pattern = "<" restr = re.replace(restr,"<") re.Pattern = "<(.*?)>" 'restr = re.replace(restr,"") re.Pattern = " " restr = re.replace(restr,"  ") re.Pattern = "\n" restr = re.replace(restr,"
") convert = restr end function %>