SCAN (string, set [,back] [,kind])
Class: Elemental function - Generic
Scans a string for any character in a set of characters. The "set"
is of type character (the same type as "string"). The "back" is of
type logical. The "kind" must be a scalar integer initialization
expression.
The result is of type integer. If "kind" is present, the kind
parameter of the result is that specified by "kind"; otherwise, the
kind parameter of the result is that of default integer. If the
processor cannot represent the result value in the kind of the
result, the result is undefined.
If "back" is absent (or is present with the value false) and
"string" has 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 "string" has 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".
If no character of "string" is in "set" or the length of "string"
or "set" is zero, the value of the result is zero.
Examples:
SCAN ('ASTRING', 'ST') has the value 2.
SCAN ('ASTRING', 'ST', BACK=.TRUE.) has the value 3.
SCAN ('ASTRING', 'CD') has the value zero.