Fortran Wiki
index

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

FORTRAN 77 and later, with kind argument Fortran 2003 and later

Class

Elemental function

Syntax

result = index(string, substring [, back [, kind]])

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)
  • kind - (Optional) An integer initialization expression indicating the kind parameter of the result.

Return Value

The return value is of type integer and of kind kind. If kind is absent, the return value is of default integer kind.

See Also

scan, verify

category: intrinsics