手机
当前位置:查字典教程网 >网页设计 >脚本HTML教程 >如何从Html页面中提取所有汉字
如何从Html页面中提取所有汉字
摘要:dimstrstr="怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码。"alertFilterChinese(str)fun...

 <SCRIPT LANGUAGE="vbScript">

dim str
str="怎样从一个Html页面中提取所有汉字呢?不能有其它Html代码。"
alert FilterChinese(str)

function FilterChinese(strInput)
dim result:result=""
dim tempStr
for i=1 to len(strInput)
tempStr=mid(strInput,i,1)
if left(escape(tempStr),2)="%u" then
result=result & tempStr
end if
next
FilterChinese=result
end function

 </SCRIPT>


if asc(tempStr)>255 then

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

 

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

 </SCRIPT>

【如何从Html页面中提取所有汉字】相关文章:

从html代码中获取Img标签

将XHTML+CSS页面转换为打印机页面

html中br和br/的区别介绍

perl如何内嵌html

PHP动态网页实现静态HTML技术的方法

html文档中的 ol 元素的序号数字极限探讨

HTML中帧标签的详细介绍

shtml页面局部缓存的实现

Html页面插入flash代码

关于HTML中的滚动条/去掉滚动条问题

精品推荐
分类导航