Scanning for a substring in Icon
If you want to know whether a particular target string t occurs anywhere within a string s, use the function
find ( t, s )
find()'' function fails.
find ( t, s )'' generates all the locations where t is found (see `Using generators in Icon').
For example, the expression
find ( "honest", "politician" )fails, while the expression
every write ( find ( "y", "syzygy" ) ) );writes three lines containing the numbers 2, 4, and 6 (the positions of ``
y'' characters within the string
John Shipman, firstname.lastname@example.org
Last updated: 1998/02/08 23:14:55 UT