Asp教程

通过asp实例结合结合ACCESS,MSSQL来更好的深入Asp学习 - 爬坡者

« ASP中通过getrows实现数据库记录分页ASP有用的文本框过滤函数 »

由给定的字符串自动生成关键字

常见的用途:

1、根据文章的标题,生成本篇文章的关键字列表

2、根据文章的标题,生成本篇文章的关键字描述(稍微修改以下程序即可)



'**************************************************
'函数名:CreateBaiduKeyWord
'作 用:由给定的字符串生成包含百度搜索的关键字链接
'参 数:Constr---要生成关键字的原字符串
'返回值:生成的关键字的链接
'**************************************************

    Function CreateBaiduKeyWord(byval Constr,Num)
       If Constr="" or IsNull(Constr)=True or Constr="" Then
          CreateBaiduKeyWord=""
          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 & "<a href='http://www.baidu.com/s?tn=hubeauty&ct=&lm=&z=&rn=&word="& Mid(Constr,i,Num) &"' target='_blank'><b>"& Mid(Constr,i,Num) & "</b></a> | "
       Next
       CreateBaiduKeyWord=ConstrTemp
    End Function

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Spirit Build 80710

Copyright 2007-2008 papozhe.com [asp教程] All Rights Reserved.
浙ICP备07030537号
免责申明:所有文章除特别声明,均来自网上,主要为学习用!内容仅供参考,版权归原作者。如侵犯您利益,请来信告知.
Email:papozhe$Gmail.com QQ:76336503