SCAN(3I) Last changed: 1-6-98
NAMESCAN - Scans a string for any one of the characters in a set of
characters
SYNOPSISSCAN ([STRING=]string, [SET=]set [,[BACK=]back])
IMPLEMENTATION
UNICOS, UNICOS/mk, and IRIX systems
STANDARDS
Fortran 90
DESCRIPTION
The SCAN intrinsic function scans a string for any one of the
characters in a set of characters. It accepts the following
arguments:
string Must be of type character.
set Must be of type character.
back Must be of type logical. If back is omitted, a value of
false is assumed.
SCAN is an elemental function. The name of this intrinsic cannot be
passed as an argument.
RETURN VALUESSCAN returns the character position of the first character in string
that matches any characters in set. The result is a default integer.
If back is absent or present with value false and if string contains
at least one character that is in set, the value of the result is the
position of the leftmost character of string that is in set.
If back is present with the value true, and if string contains at
least one character that is in set, the value of the result is the
position of the rightmost character of string that is in set.
SCAN returns zero if no character in string is in set, or if the
length of string is zero.
EXAMPLES
Example 1: The statement SCAN('FORTRAN', 'TR') returns the value 3.
Example 2: The statement SCAN('FORTRAN', 'TR', BACK=.TRUE.) returns
the value 5.
Example 3: The statement SCAN('FORTRAN', 'BCD') returns the value 0.
SEE ALSO
Intrinsic Procedures Reference Manual, publication SR-2138, for the
printed version of this man page.