网址和邮件地址的转换函数
-
functionurlconvert (str)
convertstr = str
urllocation = instr (convertstr, "http: //")
ถ้า (urllocation = 0) และ (maillocation = 0) จากนั้น
urlConvert = convertStr
exitfunction
endif
ifurllocation <> 0 แล้ว
rightstr = str
dowhileUrllocation <> urllocationend
urllocation = instr (rightstr, "http: //")
urllationend = InstrEv (RightStr, "http: //")
FinalSTR = FinalSTR & ซ้าย (RightSTR, URLLOCATION-1)
midurlstr = mid (rightstr, urllocation+1,1)
Dowhile (ASC (midurlstr)> = 45) และ (asc (midurlstr) <= 126)
loopint = loopint+1
midurlstr = mid (rightstr, urllocation+loopint, 1)
ifmidUrlstr = "" thenExitdo
วง
endurlstr = mid (rightstr, urllocation, loopint)
urlstr = "<ahref =" & endurlstr & ">" & endurlstr & "</a>"
rightstr = mid (rightstr, urllocation+loopint)
FinalSTR = FinalSTR & URLSTR
loopint = 1
วง
endif
FinalSTR = FinalSTR & RIGHTSTR
ConverTSTR1 = FINALSTR
FinalSTR = ""
maillocation = instr (convertstr1, "@")
ifmaillocation <> 0 จากนั้น
dowhilemaillocation <> maillocationend
maillocation = instr (convertstr1, "@")
maillocationend = instrrev (convertstr1, "@")
MainMidMailstr = mid (ConvertStr1, maillocation+1,1)
midmailstr = mainMidMailstr
dowhile (asc (midmailstr)> = 45) และ (asc (midmailstr) <= 126)
loopint1 = loopint1+1
midmailstr = mid (convertstr1, maillocation-loopint1,1)
วง
firstStr = mid (convertStr1, maillocation-loopint1+1, loopint1-1)
FinalSTR = FinalSTr & ซ้าย (ConverTST1, MAILLOCATION-LOOPINT1)
midmailstr1 = mainmidmailstr
dowhile (asc (midmailstr1)> = 45) และ (asc (midmailstr1) <= 126)
loopint2 = loopint2+1
midmailstr1 = mid (convertstr1, maillocation+loopint2,1)
ifmidMailstr1 = "" ThenExitdo
วง
SecondStr = mid (convertstr1, maillocation, loopint2)
endmailstr = firstStr & secondStr
mailstr = "<ahref = mailto:" & endmailstr & ">" & endmailstr & "</a>"
FinalSTR = FinalSTR & MAILSTR
ConverTSTR1 = MID (ConverTSTR1, MAILLOCATION+LOOPINT2)
loopint1 = 1
loopint2 = 1
วง
endif
FinalSTR = FinalSTR & ConverTSTR1
urlConvert = finalstr
endfunction
-