Extract a word from a string - not easy for me!

Started by tony on 27-Jan-2012/20:25:07-8:00
I've spent all day trying to extract one word from a string and am totally frustrated. Here is a string - str: "John and Terry went home" I do not want anything after the part I want to find. Find the word "went". find str "went" "went home" is returned. How do I get only the word "went"?
case [] function works good! Is there anything better??
There are several ways to achieve it depending on your usage context: 1) parse str [to "went" copy w to " "] ?? w 2) w: form fourth load str ?? w 3) w: fourth parse str none ?? w 4) pos: find str "went" w: copy/part pos find pos " " ?? w Hope this helps.
Thanks Doc! I decided to use "either" function instead. I just needed to test for a word, not retrieve it this time.

Reply