由给定的字符串生成关键字
程序员文章站
2022-04-14 20:27:13
'函数名:createkeyword '作 用:由给定的字符串生成关键字 '参 数:constr---要生成关键字的原字符串 '...
'函数名:createkeyword
'作 用:由给定的字符串生成关键字
'参 数:constr---要生成关键字的原字符串
'返回值:生成的关键字
'**************************************************
function createkeyword(byval constr,num)
if constr="" or isnull(constr)=true or constr="$false$" then
createkeyword="$false$"
exit function
end if
if num="" or isnumeric(num)=false then
num=2
end if
constr=replace(constr,chr(32),"")
constr=replace(constr,chr(9),"")
constr=replace(constr," ","")
constr=replace(constr," ","")
constr=replace(constr,"(","")
constr=replace(constr,")","")
constr=replace(constr,"<","")
constr=replace(constr,">","")
constr=replace(constr,"""","")
constr=replace(constr,"?","")
constr=replace(constr,"*","")
constr=replace(constr,"|","")
constr=replace(constr,",","")
constr=replace(constr,".","")
constr=replace(constr,"/","")
constr=replace(constr,"\","")
constr=replace(constr,"-","")
constr=replace(constr,"@","")
constr=replace(constr,"#","")
constr=replace(constr,"$","")
constr=replace(constr,"%","")
constr=replace(constr,"&","")
constr=replace(constr,"+","")
constr=replace(constr,":","")
constr=replace(constr,":","")
constr=replace(constr,"‘","")
constr=replace(constr,"“","")
constr=replace(constr,"”","")
dim i,constrtemp
for i=1 to len(constr)
constrtemp=constrtemp & "|" & mid(constr,i,num)
next
if len(constrtemp)<254 then
constrtemp=constrtemp & "|"
else
constrtemp=left(constrtemp,254) & "|"
end if
createkeyword=constrtemp
end function
'作 用:由给定的字符串生成关键字
'参 数:constr---要生成关键字的原字符串
'返回值:生成的关键字
'**************************************************
function createkeyword(byval constr,num)
if constr="" or isnull(constr)=true or constr="$false$" then
createkeyword="$false$"
exit function
end if
if num="" or isnumeric(num)=false then
num=2
end if
constr=replace(constr,chr(32),"")
constr=replace(constr,chr(9),"")
constr=replace(constr," ","")
constr=replace(constr," ","")
constr=replace(constr,"(","")
constr=replace(constr,")","")
constr=replace(constr,"<","")
constr=replace(constr,">","")
constr=replace(constr,"""","")
constr=replace(constr,"?","")
constr=replace(constr,"*","")
constr=replace(constr,"|","")
constr=replace(constr,",","")
constr=replace(constr,".","")
constr=replace(constr,"/","")
constr=replace(constr,"\","")
constr=replace(constr,"-","")
constr=replace(constr,"@","")
constr=replace(constr,"#","")
constr=replace(constr,"$","")
constr=replace(constr,"%","")
constr=replace(constr,"&","")
constr=replace(constr,"+","")
constr=replace(constr,":","")
constr=replace(constr,":","")
constr=replace(constr,"‘","")
constr=replace(constr,"“","")
constr=replace(constr,"”","")
dim i,constrtemp
for i=1 to len(constr)
constrtemp=constrtemp & "|" & mid(constr,i,num)
next
if len(constrtemp)<254 then
constrtemp=constrtemp & "|"
else
constrtemp=left(constrtemp,254) & "|"
end if
createkeyword=constrtemp
end function