最新下载
热门教程
- 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
相关文章
- 洛克王国世界妮蔓在哪里 妮蔓具体位置 10-20
- 鸣潮卜灵什么时候上线 卜灵上线时间预测 10-20
- 鸣潮千咲什么时候上线 千咲上线时间一览 10-20
- 鸣潮千咲是什么属性 千咲属性介绍一览 10-20
- 洛克王国世界拾遗任务怎么做 拾遗任务攻略一览 10-20
- 荒野起源木材怎么获得 木材获取攻略 10-20