Next: , Previous: IERRNO, Up: Intrinsic Procedures


6.102 INDEX — Position of a substring within a string

Description:
Returns the position of the start of the first occurrence of string SUBSTRING as a substring in STRING, counting from one. If SUBSTRING is not present in STRING, zero is returned. If the BACK argument is present and true, the return value is the start of the last occurrence rather than the first.
Standard:
F77 and later
Class:
Elemental function
Syntax:
RESULT = INDEX(STRING, SUBSTRING [, BACK])
Arguments:

STRING Shall be a scalar CHARACTER(*), with INTENT(IN)
SUBSTRING Shall be a scalar CHARACTER(*), with INTENT(IN)
BACK (Optional) Shall be a scalar LOGICAL(*), with INTENT(IN)

Return value:
The return value is of type INTEGER and of the default integer kind.
See also:
SCAN, VERIFY