INDEX (string, substring [,back] [,kind])
Class: Elemental function - Generic
Returns the starting position of the substring as an INTEGER*4 or
INTEGER*8 value.
"string" and "substring" are of type character, "back" is of type
logical, and "kind" is 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 false, the leftmost substring is found. If
"back" is true, the rightmost substring is found.
Examples:
INDEX ('FORTRAN', 'O', BACK = .TRUE.) has the value 2.
INDEX ('XXXX', " ", BACK = .TRUE.) has the value 0.
INDEX ('XXXX', "", BACK = .TRUE.) has the value 5.