*------------- Telecommunications & Signal Processing Lab --------------
*                          McGill University
*
*
* Module:
*     INTEGER FUNCTION INDEXR (STRING, PATTRN)
*
*
* Purpose:
*     Find the last occurrence of a string in a string
*
*
* Description:
*     This routine returns the index of the last occurrence of a
*     string.  It uses the Fortran function INDEX to determine the
*     index corresponding to the last match.
*
*
* Parameters:
* I <-  INDEXR - Position of the last match. The value zero is returned
*                if there is no match.
*
* C ->  STRING - Input string
* C ->  PATTRN - Pattern string
*
*
* Author / revision:
*     P. Kabal
*     $Revision: 1.4 $  $Date: 1995/03/08 15:37:00 $
*
*
*-----------------------------------------------------------------------

      INTEGER FUNCTION INDEXR (STRING, PATTRN)


      INTEGER IND,LENS,I

      CHARACTER*(*) STRING,PATTRN


      IND=0
      LENS=LEN(STRING)

 100  IF (IND.LT.LENS) THEN
        I=INDEX(STRING(IND+1:),PATTRN)
        IF (I.EQ.0) GO TO 200
        IND=IND+I
      GO TO 100
      END IF

 200  INDEXR=IND


      RETURN

      END
