从Html文件中提取图片文件名

Matrix1 2000-09-04 09:33:00
写一个函数过程,从Html中提取图片文件名及目录。并将他们存入一个字串数组,请高手指点,要程序代码。
...全文
190 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
subzero 2000-09-05
  • 打赏
  • 举报
回复
dim img() as string
sub parsehtml()
dim idx as long,l as long
dim tmp as string,tmp1 as string
open "yourpage.htm" for input as #1
do until eof(1)
line input #1,tmp
tmp=lcase(tmp)
l=instr(tmp,"<img")
if l<>0 then
tmp1=mid(tmp,l+1)
l=instr(tmp1,">")
if l<>0 then
tmp1=left(tmp1,l-1)
if instr(tmp1,"src=")<>0 then
idx=idx+1
end if
end if
end if
loop
close #1
redim img(idx)
idx=0
open "yourpage.htm" for input as #1
do until eof(1)
line input #1,tmp
tmp=lcase(tmp)
l=instr(tmp,"<img")
if l<>0 then
tmp1=mid(tmp,l+1)
l=instr(tmp1,">")
if l<>0 then
tmp1=left(tmp1,l-1)
if instr(tmp1,"src=")<>0 then
if mid(tmp1,instr(tmp1,"src=")+1,1)=chr(34) then
tmp1=mid(tmp1,instr(tmp1,"src=")+2)
img(idx)=left(tmp1,instr(tmp1,chr(34))-1)
idx=idx+1
else
tmp1=mid(tmp1,instr(tmp1,"src=")+1)
img(idx)=left(tmp1,instr(tmp1," ")-1)
idx=idx+1
end if
end if
end if
end if
loop
close #1
end sub
Putao 2000-09-04
  • 打赏
  • 举报
回复
关注

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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