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

[REBOL] Re: Search string x for any substring found in block y.

From: rebol665:ifrance at: 12-Dec-2001 22:41

Hi, Andrew I think this is a job for parse. rebol[] findany: func [x [string!] y [block!] /local rule][ foreach word y [ ; build a block like [to "dog" to end] rule: append append copy [to] word [to end] ;print [mold rule] if parse x rule [return true] ]; foreach return false ] x: "There is a dog in the barn" y: ["pig" "dog" "skunk"] xx: "Parse is an wonderful yet not so simple function" yy: ["rebol" "complex" "program"] yyy: ["rebol" "function"] findany x y findany xx yy findany xx yyy Patrick