Re: bug match_from (att: Matt)

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

Now that I have some more time I decided to write about the strange behaviour of
match_from(s1,s2,i2) and find_from(x,s,i2).

constant tx="Euphoria"
? find_from('h',tx,-8)		-- I get 4 
? find_from('h',tx,-9)		-- I get 0 
? match_from("ho",tx,-8)	-- I get 4 
? match_from("ho",tx,-9)	-- I get error 
-- Note: length(tx)=8


I know it is highly unexpected that somebody enters a negative number as i2 but
it happens.
(E.g. in a loop with an always changing i2 value.)

I don't speak C but something like this could be implemented

if i2<=0 then i2=1 end if


or 

if i2<=0 then return -1 end if


Regards,

Salix

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

Search



Quick Links

User menu

Not signed in.

Misc Menu