Re: bug match_from (att: Matt)
- Posted by Salix <salix at ?reemail.hu> Jul 25, 2007
- 552 views
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