最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
为字符串中的网址加上链接的程序例子
时间:2022-06-30 10:54:07 编辑:袖梨 来源:一聚教程网
Function ToLink(Str)
Dim RE '正则表达式对象
Dim strContent
If IsNull(Str) Then Str=""
Set RE = New RegExp '创建正则表达式对象
With RE
.Global = True '搜索应用于整个字符串
.IgnoreCase = True '搜索不区分大小写的
strContent=Str
'***************************************************************
'邮件地址链接自动设置
'***************************************************************
.Pattern="([w]*)@([w.]*)"
strContent=.Replace(strContent," ")
'***************************************************************
'链接自动设置
'***************************************************************
'======根据要求再添加协议名称=======
Dim D(3),I
D(0)="http"
D(1)="ftp"
D(2)="news"
D(3)="mms"
'===================================
For I=0 To UBound(D)
.Pattern=D(I) + "://([w.]*)"
strContent=.Replace(strContent," ")
Next
'***************************************************************
End With
Set RE=Nothing
ToLink=strContent
End Function
Dim RE '正则表达式对象
Dim strContent
If IsNull(Str) Then Str=""
Set RE = New RegExp '创建正则表达式对象
With RE
.Global = True '搜索应用于整个字符串
.IgnoreCase = True '搜索不区分大小写的
strContent=Str
'***************************************************************
'邮件地址链接自动设置
'***************************************************************
.Pattern="([w]*)@([w.]*)"
strContent=.Replace(strContent," ")
'***************************************************************
'链接自动设置
'***************************************************************
'======根据要求再添加协议名称=======
Dim D(3),I
D(0)="http"
D(1)="ftp"
D(2)="news"
D(3)="mms"
'===================================
For I=0 To UBound(D)
.Pattern=D(I) + "://([w.]*)"
strContent=.Replace(strContent," ")
Next
'***************************************************************
End With
Set RE=Nothing
ToLink=strContent
End Function
相关文章
- 对决剑之川T0角色有哪些 T0角色强度榜 10-30
- 辉烬赛琳娜怎么样 赛琳娜角色介绍一览 10-30
- 卡厄思梦境看板娘怎么换 看板娘更换方法 10-30
- 卡厄思梦境养成材料怎么获取 养成材料获取途径 10-30
- 卡厄思梦境伙伴怎么获取 伙伴获取攻略 10-30
- 二重螺旋武器图纸怎么获得-武器图纸高效获取攻略 10-30