Hi Ladislav,

On Wednesday, January 19, 2005, 12:01:26 PM, you wrote:

LM> another option:

LM>     find-nth: func [
LM>         "Returns the series at occurrence N of value or none."
LM>         series [series!]
LM>         value
LM>         n [integer!]
LM>         /local pos
LM>     ] [
LM>         parse series [n [to value pos: value] to end]
LM>         pos
LM>     ]

The problem here is:

>> find-nth "aaa*bbb*ccc*ddd*eee*fff" "*" 4
== "*eee*fff"
>> find-nth "aaa*bbb*ccc*ddd*eee*fff" "*" 5
== "*fff"
>> find-nth "aaa*bbb*ccc*ddd*eee*fff" "*" 6
== "*fff"
>> find-nth "aaa*bbb*ccc*ddd*eee*fff" "*" 7
== "*fff"
>> find-nth "aaa*bbb*ccc*ddd*eee*fff" "*" 8
== "*fff"

so you'd need to check PARSE's result and return NONE if it didn't
match.

Regards,
   Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]>  --  REBOL Programmer
Amiga Group Italia sez. L'Aquila  ---   SOON: http://www.rebol.it/

-- 
To unsubscribe from the list, just send an email to rebol-request
at rebol.com with unsubscribe as the subject.

Reply via email to