最新下载
热门教程
- 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
相关文章
- 对决剑之川草垛信件如何获取 09-18
- 银与绯洁希德怎么样 09-18
- 魔兽世界刀锋山草药怎么采-刀锋山草药位置分布介绍 09-18
- 重返未来1999好梦井如何玩 09-18
- 嘟嘟脸恶作剧爱蜜莉雅角色怎么样 09-18
- 地狱即我们塔尔居怎么过 第七章剧情流程视频攻略 09-18