Re: [If/then and sequences...]
Thanks Hawke',
here was my earlier attempt at doing a similar find_all() function. I
decided to always return a sequence with an empty sequence signifing that no
occurances were found. I did this because I imagined that typical use would
be to receive its result then loop though the entries...
lRC = Finds(A, B)
for i = 1 to length(lRC) do
...
end for
-------------------------------------
global function Finds(object pSubject, object pContainer)
-------------------------------------
-- Returns a sequence containing a list of subscripts, one
-- for each occurrance of pSubject in pContainer
sequence lResult
integer lSub, lStart, lEnd
lResult = {}
if sequence(pContainer)
then
lStart = 1
lEnd = length(pContainer)
while lStart <= lEnd do
lSub = find(pSubject, pContainer[lStart .. lEnd])
if lSub != 0
then
lStart += lSub
lResult &= lStart - 1
else
exit
end if
end while
-- else an object can never be contained in an atom.
end if
return lResult
end function
-----
cheers,
Derek Parnell
|
Not Categorized, Please Help
|
|