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

Parsing query.

 [1/6] from: tbrownell:l3technology at: 27-Feb-2003 13:34


Ok, Take the string... str: "This is @ test one @ test two @ some more" What is the best way to parse this so I end up with... n: ["test one" "test two" "some more"]

 [2/6] from: mat:plothatching at: 27-Feb-2003 23:03


> str: "This is @ test one @ test two @ some more" > > What is the best way to parse this so I end up with... > > n: ["test one" "test two" "some more"]
n: parse/all str "@" You'd need to do some additional monkey-work to strip the tailing spaces to get the exact result you wanted. Mat.

 [3/6] from: carl:cybercraft at: 28-Feb-2003 12:28


On 28-Feb-03, Terry Brownell wrote:
> Ok, > Take the string... > str: "This is @ test one @ test two @ some more" > What is the best way to parse this so I end up with... > n: ["test one" "test two" "some more"]
This isn't the best and doesn't give tidy strings, but it's simple, at least...
>> parse/all find/tail str "@" "@"
== [" test one " " test two " " some more"] -- Carl Read

 [4/6] from: tbrownell:l3technology at: 27-Feb-2003 15:37


Hmm, I knew that. Brain dead example on my part. Sorry

 [5/6] from: chris::langreiter::com at: 28-Feb-2003 1:28


> str: "This is @ test one @ test two @ some more" > What is the best way to parse this so I end up with... > n: ["test one" "test two" "some more"]
n: copy [] c: complement charset "@" parse str [ any c any ["@" [copy t any c (append n trim t)]] ] HTH, -- Chris

 [6/6] from: ptretter:charter at: 27-Feb-2003 20:28


parse-it: func [str /local newstr][ newstr: copy [] foreach item parse/all find str "@" "@" [append newstr trim item] return remove newstr ] Paul Tretter