📄 func.inc.asp
字号:
<%
'字符串过虑,使用固定的替换规则
'str 原始字符串
'length 字符串允许的最大长度,为 0 则不限制字符串长度
Function fixedReplaceStr(str, length)
str = trim(str)
if str = "" then fixedReplaceStr = str
str = replace(str, "'", "")
str = replace(str, ";", "")
str = replace(str, "--", "")
str = replace(str, "char", "ch ar")
str = replace(str, "script", "sc ript")
if length <> "" and Len(str) > length then
fixedReplaceStr = Left(str, length)
else
fixedReplaceStr = str
end if
End Function
function checkstr(str,lx)
if lx="" then lx="1"
if len(str)=0 then str=""
dim re, str1, str2, xx, xx1, xx2, newstr
Set re = new RegExp
re.IgnoreCase = true
re.Global = True
re.Pattern="(>"+chr(13)+")"
str=re.Replace(str,">")
re.Pattern="(> "+chr(13)+")"
str=re.Replace(str,">")
re.Pattern="(> "+chr(13)+")"
str=re.Replace(str,">")
str1=""
str2=str
xx1=1
xx=inStr(xx1,str,"<table")
do while xx>0
str1=mid(str,xx1,xx - xx1)
xx2=inStr(xx+6,str,"table>")
if xx2>0 then
ystr=mid(str,xx,xx2 + 6 - xx)
else
xx2=len(str)
ystr=mid(str,xx)
end if
newstr=newstr+addline(str1,lx)+ystr
xx1=xx2+6
xx=inStr(xx1,str,"<table")
loop
if xx1<len(str) then
str1=mid(str,xx1)
newstr=newstr+addline(str1,lx)
end if
if left(lcase(newstr),6)<>"<table" then
if lx="1" then
newstr=" "+newstr
end if
end if
checkstr=newstr
end function
function addline(str,lx)
if lx<>"1" then lx = "2"
if len(str)=0 then str=""
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern="(script)"
str=re.Replace(str,"sc ript")
re.Pattern="("+chr(13)+")"
if lx="2" then
str=re.Replace(str,"<br>")
else
str=re.Replace(str,"<br> ")
end if
addline=str
end function
function mydate(dd)
if dd="" then
mydate=""
else
mydate=year(dd)&"-"&month(dd)&"-"&day(dd)&" "&formatdatetime(dd,4)
end if
end function
function subss(ss,sublen)
dim i,tot,sstot
ss=trim(ss)
sstot=len(ss)
tot=0
i=0
do while tot<sublen and i<sstot
i=i+1
if asc(mid(ss,i,1))>0 then
tot=tot+1
else
tot=tot+2
end if
loop
subss=left(ss,i)
end function
function newtemp()
newtemp=""
for i=1 to 4
Randomize
if i mod 2=1 then
newtemp=newtemp&chr(int(rnd*26)+97)
else
newtemp=newtemp&chr(int(rnd*10)+48)
end if
next
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -