Search Site | Contact Details | FAQ

ADAS Subroutine xxfchr

      SUBROUTINE XXFCHR( CSTRNG , SSTRNG, IFIRST , ILAST )
C-----------------------------------------------------------------------
C
C  ****************** FORTRAN77 SUBROUTINE: XXFCHR *********************
C
C  PURPOSE: TO IDENTIFY THE FIRST AND LAST OCCURRENCE OF SSTRNG IN
C           CSTRNG, THE VALUES OF WHICH ARE IFIRST , ILAST.
C
C           - IF    NO    OCCURRENCE OF SSTRNG THEN IFIRST=ILAST=0
C           - IF ONLY ONE OCCURRENCE OF SSTRNG THEN IFIRST=ILAST>0
C           - IF OVER ONE OCCURRENCE OF SSTRNG THEN IFIRST>ILAST>0
C
C  NOTE   : ANY TRAILING BLANKS IN THE SEARCH STRING (SSTRNG) ARE
C           IGNORED.
C
C  CALLING PROGRAM: GENERAL USE
C
C  SUBROUTINE:
C
C  INPUT : (C*(*)) CSTRNG   = INPUT STRING FOR INTERROGATION
C  INPUT : (C*(*)) SSTRNG   = INPUT SEARCH STRING
C
C  OUTPUT: (I*4)   IFIRST   = BYTE POSITION OF FIRST OCCURRENCE OF SSTRNG
C                             IN CSTRNG.
C  OUTPUT: (I*4)   ILAST    = BYTE POSITION OF LAST  OCCURRENCE OF SSTRNG
C                             IN CSTRNG.
C
C          (I*4)   ILENC    = LENGTH OF 'CSTRNG' STRING IN BYTES
C          (I*4)   ILENS    = POSITION OF LAST  NON-BLANK BYTE IN SSTRNG
C          (I*4)   I        = GENERAL USE - INCLUDING DUMP FOR UNWANTED
C                             OUTPUT FROM XXSLEN SUBROUTINE.
C
C ROUTINES:
C          ROUTINE    SOURCE    BRIEF DESCRIPTION
C          ------------------------------------------------------------
C          XXSLEN     ADAS      FIND FIRST/LAST NONBLANK BYTES IN STRING
C
C NOTE  :  ANY TRAILING BLANKS IN THE SEARCH STRING (SSTRNG) ARE
C          IGNORED.
C
C
C AUTHOR:  LALIT JALOTA (TESSELLA SUPPORT SERVICES PLC)
C
C DATE  :  27/10/94
C
C UPDATE:  06/03/95 - REVISED BY PAUL BRIDEN (TESSELLA SUPPORT SERVICES)
C                     1) ANALYSE ALL OF CSTRNG (NOT JUST NON-BLANK
C                        PART).
C                     2) ONLY IGNORE TRAILING BLANKS FOR SSTRNG
C                        (KEEP LEADING BLANKS).
C                     3) MODIFY DO LOOP INDEX RANGE TO ENSURE THAT
C                        YOU DO NOT GO BEYOND THE END OF CSTRNG.
C                     4) VERIFY LENGTH OF SSTRNG IS NON-ZERO.
C
C UPDATE:  17/05/07 - Allan Whiteford
C                     Updated comments as part of subroutine
C                     documentation procedure.
C
C-----------------------------------------------------------------------
C-----------------------------------------------------------------------
C
C-----------------------------------------------------------------------
      CHARACTER*(*)       CSTRNG,      SSTRNG
      INTEGER             IFIRST,      ILAST
© Copyright 1995-2018 The ADAS Project
Comments and questions to: adas-at-adas.ac.uk