大家帮看一下,下面函数是什么意思??

twtetgso 2002-11-29 11:41:39
哪位大哥能帮写一下注释,小弟看不太明白。。谢谢

function ShowBody(str)
dim Spos,Epos,strURL,tmpStr,tmpPos
Spos=1
str=Replace(str,chr(34),""")
str=Replace(str,"<","<")
str=Replace(str,">",">")
str=Replace(str,chr(13)+chr(10),"<br>")
str=Replace(str,chr(9),"    ")
Spos=instr(Spos,str," http://")
if sPos>0 then
str=Replace(str," ","∧")
while (Spos>0)
Spos=instr(Spos,str,"∧http://")
if Spos>0 then
Epos=instr(Spos+1,str,"∧")
if Epos>0 then
strURL=mid(str,Spos+1,Epos-Spos-1)
strURL=lcase(strURL)
if instr(strURL,"gif")>0 or instr(strURL,"jpg")>0 then
strURL="<img src='"+strURL+"' >"
else
strURL="<a class=showdoc href="+chr(34)+strURL+chr(34)+" target=_blank>"+strURL+"</a>"
end if
tmpStr=left(str,Spos-1)+strURL+right(str,len(str)-Epos)
str=tmpstr
end if
spos=spos+5
end if
wend
str=Replace(str,"∧"," ")
else
str=Replace(str," "," ")
end if
showbody=str
end function
...全文
49 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
BrightEye 2002-11-29
  • 打赏
  • 举报
回复
就是一个replace函数,替换特殊字符.别的没什么东西.
jiangheng 2002-11-29
  • 打赏
  • 举报
回复
也就是些替换函数堆积而成的东西,你拿个实例具体测试一下,我想会很快明白的!具体注释我看就免了吧!呵呵
wpmsoft 2002-11-29
  • 打赏
  • 举报
回复
定义一个函数,有参数
function ShowBody(str)

定义几个变量
dim Spos,Epos,strURL,tmpStr,tmpPos

变量给一个初值
Spos=1

字串中的一些HTML符号进行转换,换成可以传递的符号
str=Replace(str,chr(34),""")
str=Replace(str,"<","<")
str=Replace(str,">",">")
str=Replace(str,chr(13)+chr(10),"<br>")
str=Replace(str,chr(9),"    ")


找见串中出现的" http://"位置
Spos=instr(Spos,str," http://")
if sPos>0 then

存在则把空格换成∧
str=Replace(str," ","∧")
while (Spos>0)
Spos=instr(Spos,str,"∧http://")
if Spos>0 then
Epos=instr(Spos+1,str,"∧")
if Epos>0 then
strURL=mid(str,Spos+1,Epos-Spos-1)
strURL=lcase(strURL)
if instr(strURL,"gif")>0 or instr(strURL,"jpg")>0 then
strURL="<img src='"+strURL+"' >"
else
strURL="<a class=showdoc href="+chr(34)+strURL+chr(34)+" target=_blank>"+strURL+"</a>"
end if
tmpStr=left(str,Spos-1)+strURL+right(str,len(str)-Epos)
str=tmpstr
end if
spos=spos+5
end if
wend
str=Replace(str,"∧"," ")
else
str=Replace(str," "," ")
end if
showbody=str
end function


[不好意思,太麻烦了,不再写下去了,对不起了

—————————————————————————————————
   ★ 与人玫瑰,手有余香 ★

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧