Re: question on func equal_from

new topic     » goto parent     » topic index » view thread      » older message » newer message

Salix wrote:
> 
> constant tx="very long sequence"
> 
> for i=1 to length(tx) by 1 do
> 	if i>7 and equal("https://",tx[i-7..i]) then
> 		-- do something
> 	elsif i>6 and equal("http://",tx[i-7..i]) then
> 		-- do something
> 	elsif i>5 and equal("ftp://",tx[i-7..i]) then
> 		-- do something
> 	end if
> end for

I admit I don't know what your data looks like, but
that seems too complicated and inefficient. why not
do something like this:

i = match("https://",tx)
if i = 7 then
elsif i = 6 then
elsif i = 5 then
end if


new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu