INDEX man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]

INDEX(3I)					       Last changed: 1-6-98

NAME
     INDEX - Determines the starting location of a character substring in a
     string

SYNOPSIS
     INDEX ([STRING=]string, [SUBSTRING=]substring [,[BACK=]back])

IMPLEMENTATION
     UNICOS, UNICOS/mk, and IRIX systems

STANDARDS
     Fortran 90

DESCRIPTION
     The INDEX intrinsic function returns the starting position of a
     substring within a string from either the right or left end of the
     string.  It accepts the following arguments:

     string    Must be of type character.

     substring Must be of type character.

     back      Must be of type logical.	 If omitted, a value of false is
	       assumed.	 If present, the search begins at the end of
	       string.

     INDEX is an elemental function.  The name of this intrinsic can be
     passed as an argument.

NOTES
     When the INDEX intrinsic function is passed as an actual argument, it
     must be called with only the first two arguments in the routine that
     calls the passed-in function.

RETURN VALUES
     The back argument can affect the return value as follows:

     * If back is absent or is present with the value FALSE, the INDEX
       search is relative to the left end of string.  The result is the
       minimum positive value of i, as follows:

	  string ( i : i + LEN( substring ) - 1 ) = substring

       If the length of substring is 0, a value of 1 is returned.

     * If back is present with the value TRUE, the INDEX search is relative
       to the right end of string.  The result is the maximum positive
       value of the following:

	  i <= LEN( string ) - LEN( substring ) + 1

       In the preceding equation, substring is as follows:

	  string ( i : i + LEN( substring ) - 1 ) = substring

       If the length of substring is 0, the value returned is as follows:

	  LEN( string ) + 1.

     If substring occurs more than once in string, INDEX returns the index
     to the first occurrence.

     The return value is 0 if substring is not located within string.

     The return value is 0 if the length of string is less than the length
     of substring.

EXAMPLES
     Example 1:	 INDEX('FORTRAN','R') has the value 3.

     Example 2:	 INDEX('FORTRAN','R',BACK=.TRUE.) has the value 5.

     Example 3:	 The following program returns the index I=11 for the
     substring SUPERCOMPUTER:

	  PROGRAM INDEX1
	  CHARACTER*23 A
	  CHARACTER*13 B
	  A = 'CRAY T90 SUPERCOMPUTER'
	  B = 'SUPERCOMPUTER'
	  I = INDEX(A,B)
	  PRINT *, I
	  STOP
	  END

SEE ALSO
     Intrinsic Procedures Reference Manual, publication SR-2138, for the
     printed version of this man page.

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net