News flash: I'm going to Australia in February, so this Web site may be switched off at any time.


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 )

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 "syzygy").
Next: Implicit scanning in Icon
See also: Using the Icon programming language
Previous: Checking for an initial substring in Icon

John W. Shipman, john@nmt.edu