Re: Euphoria Standard Library
- Posted by "Thomas Parslow (PatRat)" <patrat at rat-software.com> Jul 23, 2001
- 370 views
I find these two very useful: --find any element of "fnd" in "in" function find_any(sequence fnd,sequence in) for i = 1 to length(in) do if find(in[i],fnd) then return i end if end for return 0 end function --find "fnd" as the "sub_element" element of an element of "in" --EXAMPLE: --constant IN={{"ONE","TWO"},{"THREE","FOUR"},{"FIVE","SIX"},{"SEVEN","EIGHT"},{"NINE","TEN"}} --? sub_find("FOUR",IN,2) --returns 2 --? sub_find("FOUR",IN,1) --returns 0 function sub_find(object fnd, sequence in, integer sub_element) for i = 1 to length(in) do if length(in[i]) => sub_element and equal(fnd,in[i][sub_element]) then return i end if end for return 0 end function Thomas Parslow (PatRat) ICQ #:26359483 Rat Software http://www.rat-software.com/ Please leave quoted text in place when replying