Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Find? Copy/Part?

From: carlos:lorenz:gma:il at: 18-Jan-2005 15:05

Ingo, Thanks for you reply. I dir not think about parse though I can see you solve it using it. Parse yet has a not so confortable sintax to me so I try to avoid the use of it most part of the time. I'd like to have something just like I get in Visual Fox Pro. See below: * ------------------------------------------ a = "aaa*aaa*aaa*aaa" * gets the second ocurrence of "*" in the string from left to right pos = at( "*" , a , 2) * then asking VFP to grab a piece of the string up to the * second "*" in the string a ? left(a,pos) * gives the result aaa*aaa* * ------------------------------------------- Would it be very nice to have an AT-like native function in REBOL/Core, don't you think so? On Tue, 18 Jan 2005 23:38:43 +0900, Ingo Hohmann <[ingo--2b1--de]> wrote:
> Hi Carlos, > > here are the first 4 ideas I got > > >> profiler/test [index? find next find str #"*" #"*"] 100000 > > == [0:00:00.213723] > >> profiler/test [parse str [2 [thru "*"] here: (pos: subtract index? > here 1)]] 100000 > == [0:00:00.156568] > >> profiler/test [parse str [2 [thru #"*"] here: (pos: subtract index? > here 1)]] 100000 > == [0:00:00.14909] > >> profiler/test [parse str [thru #"*" to #"*" here: (pos: index? here > )]] 100000 > == [0:00:00.106628] > > As you'll clearly notice, parse is your friend ;0) > > I hope that helps > > Ingo > > Carlos Lorenz wrote: > > Hi list, > > > > Suppose I have str: "aaa*aaa*aaa*aaa" > > > > Wich is the best way to get the position of second "*" at word str? > > > > > -- > To unsubscribe from the list, just send an email to rebol-request > at rebol.com with unsubscribe as the subject. >
-- *:-.,_,.-:*'``'*:-.,_,.-: Carlos Lorenz *:-.,_,.-:*'``'*:-.,_,.-: