最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 编程开发 > asp教程

从Html页面中提取所有汉字ASP技巧

日期:11-09    来源:    作者:

<SCRipT LANGUAGE="vbScript">mhe中国设计秀
dim strmhe中国设计秀
str="怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码。"mhe中国设计秀
alert FilterChinese(str)mhe中国设计秀

function FilterChinese(strInput)mhe中国设计秀
dim result:result=""mhe中国设计秀
dim tempStrmhe中国设计秀
for i=1 to len(strInput)mhe中国设计秀
tempStr=mid(strInput,i,1)mhe中国设计秀
if left(escape(tempStr),2)="%u" thenmhe中国设计秀
result=result & tempStrmhe中国设计秀
end ifmhe中国设计秀
nextmhe中国设计秀
FilterChinese=resultmhe中国设计秀
end functionmhe中国设计秀

 </SCRIPT>mhe中国设计秀

mhe中国设计秀
if asc(tempStr)>255 thenmhe中国设计秀

用正则表达式的方法mhe中国设计秀
<SCRIPT LANGUAGE="vbScript">mhe中国设计秀
dim strmhe中国设计秀
str="怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码。"mhe中国设计秀
alert RegExpTest("[u4e00-u9fa5]",str)mhe中国设计秀

 mhe中国设计秀

Function RegExpTest(patrn, strng)mhe中国设计秀
   Dim regEx, Match, Matches   ' 建立变量。mhe中国设计秀
   Set regEx = New RegExp   ' 建立正则表达式。mhe中国设计秀
   regEx.Pattern = patrn   ' 设置模式。mhe中国设计秀
   regEx.IgnoreCase = True   ' 设置是否区分大小写。mhe中国设计秀
   regEx.Global = True   ' 设置全局替换。mhe中国设计秀
   Set Matches = regEx.Execute(strng)   ' 执行搜索。mhe中国设计秀
   For Each Match in Matches   ' 遍历 Matches 集合。mhe中国设计秀
      RetStr = RetStr  &  Match.Valuemhe中国设计秀
   Nextmhe中国设计秀
   RegExpTest = RetStrmhe中国设计秀
End Functionmhe中国设计秀

 </SCRIPT>mhe中国设计秀

本文引用地址:/bc/article_46506.html
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明