国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

如何從Html頁面中提取所有漢字

2019-11-18 19:03:55
字體:
來源:轉載
供稿:網友

<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>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 都安| 贡觉县| 茶陵县| 凤冈县| 庄河市| 盈江县| 唐山市| 牡丹江市| 长子县| 古浪县| 阿城市| 岚皋县| 台湾省| 金坛市| 广宁县| 平原县| 凤城市| 多伦县| 台东市| 水富县| 惠州市| 牙克石市| 丘北县| 柳林县| 五指山市| 望都县| 东方市| 明水县| 太康县| 永德县| 红河县| 安多县| 巴东县| 海丰县| 增城市| 孝昌县| 皋兰县| 定兴县| 钟祥市| 雅安市| 枣庄市|