[REBOL] Re: [FIND] [FoxPro] Re: Find? Copy/Part?
From: gabriele:colellachiara at: 19-Jan-2005 12:23
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 <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/