用asp實現(xiàn)網(wǎng)址和郵件地址的轉(zhuǎn)換函數(shù)
更新時間:2007年11月24日 22:06:43 作者:
網(wǎng)址和郵件地址的轉(zhuǎn)換函數(shù)
<%
function URLconvert(str)
convertstr=str
urlLocation=instr(convertstr,"http://")
if (urlLocation=0) and (mailLocation=0) then
URLconvert=convertstr
exit function
end if
if urlLocation<>0 then
rightstr=str
Do while urlLocation<>urlLocationend
urlLocation=instr(rightstr,"http://")
urlLocationend=InStrRev(rightstr,"http://")
finalstr=finalstr&left(rightstr,urlLocation-1)
midurlstr=mid(rightstr,urlLocation+1,1)
do while (asc(midurlstr)>=45) and (asc(midurlstr)<=126)
loopint=loopint+1
midurlstr=mid(rightstr,urlLocation+loopint,1)
if midurlstr="" then exit do
loop
endURLstr=mid(rightstr,urllocation,loopint)
URLstr="<a href="&endURLstr&">"&endURLstr&"</a>"
rightstr=mid(rightstr,urllocation+loopint)
finalstr=finalstr&URLstr
loopint=1
Loop
end if
finalstr=finalstr&rightstr
convertstr1=finalstr
finalstr=""
mailLocation=instr(convertstr1,"@")
if mailLocation<>0 then
Do while mailLocation<>mailLocationend
mailLocation=instr(convertstr1,"@")
mailLocationend=InStrRev(convertstr1,"@")
mainmidmailstr=mid(convertstr1,mailLocation+1,1)
midmailstr=mainmidmailstr
do while (asc(midmailstr)>=45) and (asc(midmailstr)<=126)
loopint1=loopint1+1
midmailstr=mid(convertstr1,mailLocation-loopint1,1)
loop
firstSTR=mid(convertstr1,mailLocation-loopint1+1,loopint1-1)
finalstr=finalstr&left(convertstr1,mailLocation-loopint1)
midmailstr1=mainmidmailstr
do while (asc(midmailstr1)>=45) and (asc(midmailstr1)<=126)
loopint2=loopint2+1
midmailstr1=mid(convertstr1,mailLocation+loopint2,1)
if midmailstr1="" then exit do
loop
secondSTR=mid(convertstr1,mailLocation,loopint2)
endmailstr=firstSTR&secondSTR
mailstr="<a href=mailto:"&endmailstr&">"&endmailstr&"</a>"
finalstr=finalstr&mailstr
convertstr1=mid(convertstr1,maillocation+loopint2)
loopint1=1
loopint2=1
Loop
end if
finalstr=finalstr&convertstr1
URLconvert=finalstr
end function
%>
<%
function URLconvert(str)
convertstr=str
urlLocation=instr(convertstr,"http://")
if (urlLocation=0) and (mailLocation=0) then
URLconvert=convertstr
exit function
end if
if urlLocation<>0 then
rightstr=str
Do while urlLocation<>urlLocationend
urlLocation=instr(rightstr,"http://")
urlLocationend=InStrRev(rightstr,"http://")
finalstr=finalstr&left(rightstr,urlLocation-1)
midurlstr=mid(rightstr,urlLocation+1,1)
do while (asc(midurlstr)>=45) and (asc(midurlstr)<=126)
loopint=loopint+1
midurlstr=mid(rightstr,urlLocation+loopint,1)
if midurlstr="" then exit do
loop
endURLstr=mid(rightstr,urllocation,loopint)
URLstr="<a href="&endURLstr&">"&endURLstr&"</a>"
rightstr=mid(rightstr,urllocation+loopint)
finalstr=finalstr&URLstr
loopint=1
Loop
end if
finalstr=finalstr&rightstr
convertstr1=finalstr
finalstr=""
mailLocation=instr(convertstr1,"@")
if mailLocation<>0 then
Do while mailLocation<>mailLocationend
mailLocation=instr(convertstr1,"@")
mailLocationend=InStrRev(convertstr1,"@")
mainmidmailstr=mid(convertstr1,mailLocation+1,1)
midmailstr=mainmidmailstr
do while (asc(midmailstr)>=45) and (asc(midmailstr)<=126)
loopint1=loopint1+1
midmailstr=mid(convertstr1,mailLocation-loopint1,1)
loop
firstSTR=mid(convertstr1,mailLocation-loopint1+1,loopint1-1)
finalstr=finalstr&left(convertstr1,mailLocation-loopint1)
midmailstr1=mainmidmailstr
do while (asc(midmailstr1)>=45) and (asc(midmailstr1)<=126)
loopint2=loopint2+1
midmailstr1=mid(convertstr1,mailLocation+loopint2,1)
if midmailstr1="" then exit do
loop
secondSTR=mid(convertstr1,mailLocation,loopint2)
endmailstr=firstSTR&secondSTR
mailstr="<a href=mailto:"&endmailstr&">"&endmailstr&"</a>"
finalstr=finalstr&mailstr
convertstr1=mid(convertstr1,maillocation+loopint2)
loopint1=1
loopint2=1
Loop
end if
finalstr=finalstr&convertstr1
URLconvert=finalstr
end function
%>
您可能感興趣的文章:
- ASP用JMail、CDO發(fā)送郵件
- Jmail組件發(fā)送郵件之絕對能用的函數(shù)
- asp jmail發(fā)郵件 詳細解析
- asp.net2.0實現(xiàn)郵件發(fā)送(測試成功)
- Jmail 圖文安裝教程 asp在線發(fā)送郵件組件
- ASP.Net郵箱發(fā)郵件實例代碼
- .net jMail郵件發(fā)送(含抄送、密送、多發(fā)、日志記錄)實例代碼
- asp.net發(fā)郵件的幾種方法匯總
- Jmail發(fā)送郵件與帶附件亂碼解決辦法分享
- asp.net發(fā)送郵件示例分享
- asp.net發(fā)郵件示例
- asp.net發(fā)送郵件實現(xiàn)方法
- asp+JMAIL實現(xiàn)發(fā)送郵件
相關(guān)文章
[ASP]RegExp對象提供簡單的正則表達式支持功能使用說明
[ASP]RegExp對象提供簡單的正則表達式支持功能使用說明...2007-07-07ASP中使用FileSystemObject時提高性能的方法
在封裝自己的FileSystemObject庫的時候,測試的時候發(fā)現(xiàn)在文件夾或文件很多的時候,效率很低,顯示一個文件夾需要2秒甚至更多,這讓我很是奇怪,因為顯示文件夾及文件信息的時候直接都是使用Folder及File對象的屬性,這應(yīng)該不會引起性能上的問題,但是事實卻說明我的想法過于簡單了。2008-05-05關(guān)于WPF?WriteableBitmap類直接操作像素點的問題
WPF是微軟新一代圖形系統(tǒng),運行在.NET Framework 3.0及以上版本下,為用戶界面、2D/3D 圖形、文檔和媒體提供了統(tǒng)一的描述和操作方法,本文重點給大家介紹WPF?WriteableBitmap類直接操作像素點的問題,感興趣的朋友一起看看吧2022-01-01asp中使用MSXML2.DOMDocument處理XML數(shù)據(jù)時的注意事項
這篇文章主要介紹了asp中使用MSXML2.DOMDocument處理XML數(shù)據(jù)時的注意事項,本文給出了4個需要注意的問題,需要的朋友可以參考下2014-08-08