设为首页收藏本站

新微赢技术网

 找回密码
 注册
搜索
热搜: 回贴
查看: 8987|回复: 1
打印 上一主题 下一主题

asp实现文章自动截取关键词

[复制链接]
跳转到指定楼层
1#
发表于 2009-11-30 00:23:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
代码如下:
<%

'转自:http://www.zzwbn.cn
function createkeyword(byval bestr)
if bestr = "" or isnull(bestr) = true or bestr = "" then createkeyword = "" : exit function
dim strChar,strTmp
For i = 1 To Len(bestr)
strChar = Mid(bestr,i,1)
If (Asc(strChar)>=-24648 And Asc(strChar)<=-23553) Then strTmp = strTmp & Chr(Asc(strChar)+23680) Else strTmp = strTmp & strChar   
Next
bestr = replace(strTmp,chr(32),"")
bestr = replace(bestr,chr(9),"")
bestr = replace(bestr," ","") : bestr = replace(bestr,"^","")
bestr = replace(bestr,"'","") : bestr = replace(bestr,"""","")
bestr = replace(bestr,"~","") : bestr = replace(bestr,"-","")
bestr = replace(bestr,"+","") : bestr = replace(bestr,"*","")
bestr = replace(bestr,"/","") : bestr = replace(bestr,"\","")
bestr = replace(bestr,"|","") : bestr = replace(bestr,".","")
bestr = replace(bestr,"@","") : bestr = replace(bestr,"#","")
bestr = replace(bestr,"$","") : bestr = replace(bestr,"%","")
bestr = replace(bestr,"&","") : bestr = replace(bestr,"!","")
bestr = replace(bestr,"?","") : bestr = replace(bestr,",","")
bestr = replace(bestr,":","") : bestr = replace(bestr,";","")
bestr = replace(bestr,"(","") : bestr = replace(bestr,")","")
bestr = replace(bestr,"{","") : bestr = replace(bestr,"}","")
bestr = replace(bestr,"<","") : bestr = replace(bestr,">","")
bestr = replace(bestr,"[","") : bestr = replace(bestr,"]","")
dim t1,t2,i,c,n,e
randomize timer
for i = 1 to len(bestr)
c = Asc(Mid(bestr,i,1))
if (c >= 65 and c <= 90) or (c >= 97 and c <= 122) or (c >= 48 and c <= 57) then e = "" else e = Chr(44)
if Abs(c) > 127 then n = Int((1) * Rnd + 2) else n = 1
if instr(t1,mid(bestr,i,1)) > 0 and Abs(c) > 127 then t1 = t1 else t1 = t1 & e & mid(bestr,i,n)
next
for i = 0 to ubound(split(t1,","))-1
t2 = t2 & e & split(t1,",")(i)
next
if left(t2,1) = chr(44) then t2 = mid(replace(t2,",,",""),2,len(t2))
createkeyword = t2
end function
%>
其实AC编码我不很懂~其中的24648原是23648
作用是去掉“~!@#¥%……&×()——+”望赐教。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

申请友链|小黑屋|最新主题|手机版|新微赢技术网 ( 苏ICP备08020429号 )  

GMT+8, 2024-11-19 10:15 , Processed in 0.107663 second(s), 9 queries , Gzip On, Memcache On.

Powered by xuexi

© 2001-2013 HaiAn.Com.Cn Inc. 寰耽

快速回复 返回顶部 返回列表