Next
/
Previous
/ Index
/ TCC Help System
/ Publications
/ Site map
/ NM Tech homepage
Checking for an initial substring in Icon
|
|
To check whether a string begins with a particular sequence of
characters, use the function
match ( t, s )
where t is the target string to be searched for, and
s is the string to be searched.
- If t matches the initial characters of s,
the function returns the position within s
just after the part that matched t.
- If t does not match the initial
characters of s, the ``
match()'' function fails.
For example, the expression
match ( "foo", "rumplestiltskin" )
fails, while the expression
match ( "foo", "foobar" )
succeeds and returns the value 4, which is the position just to the
left of the "bar" in the second argument.
Next: Scanning for a substring in Icon
See also: Using strings in Icon
Previous: Checking the initial characters of a string in Icon
Site map
Index:
Keyword index
to help pages
Help:
New Mexico Tech Computer Center: Help System
TCC Publications
Home:
About New Mexico Tech
John Shipman, john@nmt.edu
Last updated: 1996/01/06 21:12:57 UT
URL: http://www.nmt.edu/tcc/help/lang/icon/match.html