codice:
Testo= contenuto pagina
Testo=W3C_Parser_Attribute_Apici(Testo," color=","<F")
Function W3C_Parser_Attribute_Apici(Testo,Attributo_parser,TAG)
Dim Ind_Conta
Dim Chiave
Dim Chiave1
Dim Chiave2
Dim Inizio
Dim Fine
Dim Inizio1
Dim Fine3
Dim Fine1
Dim Fine2
Dim Ind
Dim Testo_Temp
Dim Vettore_testo(100000)
Dim Index_vettore
Dim Testo_Split
Dim Testo_Splittato
if false
Ind=1
Ind_Conta=0
Chiave=""
do
inizio=instr(Ind,Testo,TAG,1)
'SDEBUG("inizio=" & inizio)
if inizio>0 then
fine=instr(inizio,Testo,">")
if fine>inizio then
Chiave=mid(Testo,inizio,fine-inizio+1)
if instr(1,Chiave,Attributo_parser,1)>0 then
inizio1=instr(1,Chiave,Attributo_parser,1)+len(Attributo_parser)
fine1=instr(inizio1,Chiave,">",1)-1
fine2=instr(inizio1,Chiave," ",1)-1
if fine1<=0 then
fine1=1000000
end if
if fine2<=0 then
Fine2=1000000
end if
if fine1<Fine2 then
Fine3=Fine1
else
Fine3=Fine2
end if
IF fine3-inizio1+1>0 THEN
Chiave1=mid(Chiave,inizio1,fine3-inizio1+1)
If left(trim(Chiave1),1)<>"""" and right(trim(Chiave1),1)<>"""" then
Chiave1="""" & trim(Chiave1) & """ "
Chiave=left(Chiave,inizio1-1) & Chiave1 & right(Chiave,len(Chiave)-fine3)
end if
END IF
end if
Testo=left(Testo,inizio-1) & Chiave & right(Testo,len(Testo)-fine-len(">")+1)
end if
else
exit do
end if
Ind=inizio+1
Ind_Conta=Ind_Conta+1
loop
else
Testo_Splittato=split(testo,TAG)
Index_vettore=0
Ind_Conta=0
for each Testo_Split in Testo_Splittato
Ind=1
Chiave=""
if Ind_Conta>0 then
Testo_Temp=TAG & Testo_Split
do
inizio=instr(Ind,Testo_Temp,TAG,1)
if inizio>0 then
fine=instr(inizio,Testo_Temp,">")
if fine>inizio then
Chiave=mid(Testo_Temp,inizio,fine-inizio+1)
if instr(1,Chiave,Attributo_parser,1)>0 then
inizio1=instr(1,Chiave,Attributo_parser,1)+len(Attributo_parser)
fine1=instr(inizio1,Chiave,">",1)-1
fine2=instr(inizio1,Chiave," ",1)-1
if fine1<=0 then
fine1=1000000
end if
if fine2<=0 then
Fine2=1000000
end if
if fine1<Fine2 then
Fine3=Fine1
else
Fine3=Fine2
end if
IF fine3-inizio1+1>0 THEN
Chiave1=mid(Chiave,inizio1,fine3-inizio1+1)
If left(trim(Chiave1),1)<>"""" and right(trim(Chiave1),1)<>"""" then
Chiave1="""" & trim(Chiave1) & """ "
Chiave=left(Chiave,inizio1-1) & Chiave1 & right(Chiave,len(Chiave)-fine3)
end if
END IF
end if
Testo_Temp=left(Testo_Temp,inizio-1) & Chiave & right(Testo_Temp,len(Testo_Temp)-fine-len(">")+1)
end if
else
exit do
end if
Ind=inizio+1
Ind_Conta=Ind_Conta+1
loop
else
Ind_Conta=Ind_Conta+1
Testo_Temp=Testo_Split
end if
Vettore_testo(Index_vettore)=Testo_Temp
Index_vettore=Index_vettore+1
next
Testo=""
for ind=0 to Index_vettore-1
Testo=Testo & Vettore_testo(ind)
next
end if
W3C_Parser_Attribute_Apici=testo
end function