Re: find_all() And More
- Posted by DerekParnell (admin) Sep 29, 2010
- 1128 views
mattlewis said...
I'd try something like this:
Here's a tweak to Matt's code ...
constant a = { 0, 1, 2, 3, 0 } function find_all_but( object needle, sequence haystack ) integer ix = 1 integer jx integer kx = 0 while jx with entry do for i = ix to jx - 1 do kx += 1 haystack[kx] = i end for ix = jx + 1 entry jx = find( needle, haystack, ix ) end while for i = ix to length(haystack) do kx += 1 haystack[kx] = i end for return haystack[1 .. kx] end function ? find_all_but( 0, a )