ASP.NET 函数问题!求大神解答……
PrivateFunctionProcessUbbCode_Key(strText)Dims,i,sContentKeyword,ArrayKeyword,strKeyw...
Private Function ProcessUbbCode_Key(strText)
Dim s,i,sContentKeyword,ArrayKeyword,strKeyword
s=strText
If Trim(ContentKeyword) <> "" Then
sContentKeyword = Split(ContentKeyword, "@@@")
If UBound(sContentKeyword) > 1 Then
For i = 0 To UBound(sContentKeyword) - 1
ArrayKeyword = Split(sContentKeyword(i), "$$$")
If ArrayKeyword(0) <> "" Then
strKeyword = ArrayKeyword(0)
If Left(strKeyword,1) = "|" Then strKeyword = Replace(strKeyword, "|", vbNullString,1,1)
If Right(strKeyword,1) = "|" Then strKeyword = Left(strKeyword,Len(strKeyword)-1)
re.Pattern = "(^|[^\/\\\w\=])(" & Replace(strKeyword, "$", "\$") & ")"
s=re.Replace(s, "$1<a target=""_blank"" href=""" & ArrayKeyword(1) & """ class=""UBBWordLink"">$2</a>")
re.Global = False
End If
Next
End If
End If
ProcessUbbCode_Key=s
End Function
以上是关键词加链接的函数,判断是所有关键词都加链接。我需要加段 系统只给20个关键词加链接! 展开
Dim s,i,sContentKeyword,ArrayKeyword,strKeyword
s=strText
If Trim(ContentKeyword) <> "" Then
sContentKeyword = Split(ContentKeyword, "@@@")
If UBound(sContentKeyword) > 1 Then
For i = 0 To UBound(sContentKeyword) - 1
ArrayKeyword = Split(sContentKeyword(i), "$$$")
If ArrayKeyword(0) <> "" Then
strKeyword = ArrayKeyword(0)
If Left(strKeyword,1) = "|" Then strKeyword = Replace(strKeyword, "|", vbNullString,1,1)
If Right(strKeyword,1) = "|" Then strKeyword = Left(strKeyword,Len(strKeyword)-1)
re.Pattern = "(^|[^\/\\\w\=])(" & Replace(strKeyword, "$", "\$") & ")"
s=re.Replace(s, "$1<a target=""_blank"" href=""" & ArrayKeyword(1) & """ class=""UBBWordLink"">$2</a>")
re.Global = False
End If
Next
End If
End If
ProcessUbbCode_Key=s
End Function
以上是关键词加链接的函数,判断是所有关键词都加链接。我需要加段 系统只给20个关键词加链接! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询