最新下载
热门教程
- 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,"$1@$2 ")
'***************************************************************
'链接自动设置
'***************************************************************
'======根据要求再添加协议名称=======
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,"" + D(I) + "://$1 ")
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,"$1@$2 ")
'***************************************************************
'链接自动设置
'***************************************************************
'======根据要求再添加协议名称=======
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,"" + D(I) + "://$1 ")
Next
'***************************************************************
End With
Set RE=Nothing
ToLink=strContent
End Function
相关文章
- 无畏契约源能行动不死鸟实战 玩法技巧分享 07-12
- Opyn的顶尖人才转投Coinbase,战略重心转向链上衍生品 07-12
- 原神伊涅芙配队怎么配 伊涅芙最强配队推荐 07-12
- 无畏契约源能行动雷兹实战 玩法技巧分享 07-12
- 梦幻西游铸魂任务怎么做-铸魂任务攻略 07-12
- 剑星全钓鱼点与限定稀有鱼在哪里 钓鱼点及稀有鱼位置分享 07-12