查看: 241|回复: 0

[ASP函数] ASP提取字符串中的中文字符

[复制链接]
xuanxiao 发表于 2022-11-14 12:26:08 | 显示全部楼层 |阅读模式

  1. Dim str
  2. str="<div title='影视杂谈,原著解读。' class='desc'>"
  3. print Get_Chinese(true, str)


  4. 'Gloabl:搜索全局,str:被检索字符串
  5. Function Get_Chinese(ByVal global,ByVal str)
  6.         dim reg,macher,count,i,temp
  7.                 temp=""
  8.                 Set reg = New RegExp
  9.                 reg.Pattern="[\u4e00-\u9fa5]+"
  10.                 reg.Global=global
  11.          Set macher=reg.Execute(str)
  12.           count=macher.Count
  13.                 If count>0 Then
  14.                 For i=0 To count-1
  15.                 temp=temp&macher(i)
  16.                 Next
  17.                 End if
  18. Get_Chinese=temp
  19. End function
复制代码


微信截图_20221114122538.png
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

在线客服

售前咨询
售后咨询
服务热线
023-58418553
微信公众号