http://www.foresight.com.hk/bbs asp 版 必须http://开头,以空格或回车还行结束,如果出现,()将会出现错误的连接。 Function setLink(str) '$ID:2002-6-24 10:10 '@Function: set string "http://" to link '@Ver1.0 '@Author:[email protected]
if intDeal<=0 then exit function end if 'get first space after intDeal
args=split(setLink,"http") buf="" for i=0 to Ubound(args)
if (left(args(i),3)<>"://" ) then buf=buf&args(i) 'store 偶数 else linktmp=args(i) strlink=linktmp nbsp="" intSpace=instr(linktmp," ") intBr=instr(linktmp,"<br>") if intSpace>intBr then intSpace=intBr if intSpace>0 then strlink=trim(left(linktmp,intSpace-1)) nbsp=mid(linktmp,intSpace) end if strlink="http"&strlink strlink="<a href="""&strlink&""" target=_blank>"&strlink&"</a>" 
buf=buf&strlink 'store link end if next
setLink=buf End Function
Function setLink(str) '$ID:2002-6-27 17:39 '@Function: set string "http://" to link '@Ver1.1 '@Author:[email protected] 'Fix ']) '&FullSpace ,etc. setLink=str setLink=replace(setLink,"HTTP://","http://") setLink=replace(setLink," "," ") setLink=replace(setLink,chr(13),"<br>") setLink=replace(setLink,"<br>","<br>") setLink=replace(setLink,"<BR>","<br>") setLink=replace(setLink,"''",chr(39)) intDeal= instr(setLink,"http://")
if intDeal<=0 then exit function end if 'get first space after intDeal
args=split(setLink,"http") buf="" for i=0 to Ubound(args)
if (left(args(i),3)<>"://" ) then buf=buf&args(i) 'store 偶数 else linktmp=args(i) strlink=linktmp nbsp="" intSpace=instr(linktmp," ") intBr=instr(linktmp,"<br>") if intSpace>intBr then intSpace=intBr
intUnKnow=instr(linktmp,"。") if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow intUnKnow=instr(linktmp,")") if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow intUnKnow=instr(linktmp,",") if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow intUnKnow=instr(linktmp,"]") if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow intUnKnow=instr(linktmp," ") '中文半角空格 if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow intUnKnow=instr(linktmp," ")'中文全角空格 if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow intUnKnow=instr(linktmp,"(") if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow intUnKnow=instr(linktmp,")") if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow if intSpace>0 then strlink=trim(left(linktmp,intSpace-1)) nbsp=mid(linktmp,intSpace) end if strlink="http"&strlink strlink="<a href="""&strlink&""" target=_blank>"&strlink&"</a>" 
asp 版
必须http://开头,以空格或回车还行结束,如果出现,()将会出现错误的连接。
Function setLink(str)
'$ID:2002-6-24 10:10
'@Function: set string "http://" to link
'@Ver1.0
'@Author:[email protected]
setLink=str
setLink=replace(setLink,"HTTP://","http://")
setLink=replace(setLink," "," ")
setLink=replace(setLink,chr(13),"<br>")
setLink=replace(setLink,"<br>","<br>")
setLink=replace(setLink,"<BR>","<br>")
setLink=replace(setLink,"''",chr(39))
intDeal= instr(setLink,"http://")
if intDeal<=0 then
exit function
end if
'get first space after intDeal
args=split(setLink,"http")
buf=""
for i=0 to Ubound(args)
if (left(args(i),3)<>"://" ) then
buf=buf&args(i) 'store 偶数
else
linktmp=args(i)
strlink=linktmp
nbsp=""
intSpace=instr(linktmp," ")
intBr=instr(linktmp,"<br>")
if intSpace>intBr then intSpace=intBr
if intSpace>0 then
strlink=trim(left(linktmp,intSpace-1))
nbsp=mid(linktmp,intSpace)
end if
strlink="http"&strlink
strlink="<a href="""&strlink&""" target=_blank>"&strlink&"</a>" 
buf=buf&strlink 'store link
end if
next
setLink=buf
End Function
'$ID:2002-6-27 17:39
'@Function: set string "http://" to link
'@Ver1.1
'@Author:[email protected]
'Fix ']) '&FullSpace ,etc.
setLink=str
setLink=replace(setLink,"HTTP://","http://")
setLink=replace(setLink," "," ")
setLink=replace(setLink,chr(13),"<br>")
setLink=replace(setLink,"<br>","<br>")
setLink=replace(setLink,"<BR>","<br>")
setLink=replace(setLink,"''",chr(39))
intDeal= instr(setLink,"http://")
if intDeal<=0 then
exit function
end if
'get first space after intDeal
args=split(setLink,"http")
buf=""
for i=0 to Ubound(args)
if (left(args(i),3)<>"://" ) then
buf=buf&args(i) 'store 偶数
else
linktmp=args(i)
strlink=linktmp
nbsp=""
intSpace=instr(linktmp," ")
intBr=instr(linktmp,"<br>")
if intSpace>intBr then intSpace=intBr
intUnKnow=instr(linktmp,"。")
if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow
intUnKnow=instr(linktmp,")")
if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow
intUnKnow=instr(linktmp,",")
if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow
intUnKnow=instr(linktmp,"]")
if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow
intUnKnow=instr(linktmp," ") '中文半角空格
if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow
intUnKnow=instr(linktmp," ")'中文全角空格
if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow
intUnKnow=instr(linktmp,"(")
if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow
intUnKnow=instr(linktmp,")")
if intSpace>intUnKnow and intUnKnow<>0 then intSpace=intUnKnow
if intSpace>0 then
strlink=trim(left(linktmp,intSpace-1))
nbsp=mid(linktmp,intSpace)
end if
strlink="http"&strlink
strlink="<a href="""&strlink&""" target=_blank>"&strlink&"</a>" 
buf=buf&strlink 'store link
end if
next
setLink=buf
End Function