Sun Studio 12: Fortran Library Reference

1.4.27.1 index: First Occurrence of a Substring in a String

The index is an intrinsic function called by:

n = index( a1, a2 )

a1

character

Input 

Main string 

a2

character

Input 

Substring

Return value 

INTEGER

Output 

n>0: Index of first occurrence of a2 in a1

n=0: a2 does not occur in a1.

If declared INTEGER*8, index() will return an INTEGER*8 value when compiled for a 64-bit environment and character variable a1 is a very large character string (greater than 2 Gigabytes).