1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
C*GRTRIM -- length of string excluding trailing blanks
C+
INTEGER FUNCTION GRTRIM(S)
CHARACTER*(*) S
C
C Find the length of a character string excluding trailing blanks.
C A blank string returns a value of 0.
C
C Argument:
C S (input) : character string.
C
C Returns:
C GRTRIM : number of characters in S, excluding trailing
C blanks, in range 0...LEN(S). A blank string
C returns a value of 0.
C
C Subroutines required:
C None
C
C Fortran 77 extensions:
C None
C
C History:
C 1987 Nov 12 - TJP.
C-----------------------------------------------------------------------
INTEGER I
C
C next card falls over bug 8 in Fortran so invert it!
C D.J. Crennell 27 April 1996
C IF (S.EQ.' ') THEN
IF (' '.EQ.S) THEN
GRTRIM = 0
ELSE
DO 10 I=LEN(S),1,-1
GRTRIM = I
IF (S(I:I).NE.' ') GOTO 20
10 CONTINUE
GRTRIM = 0
20 CONTINUE
END IF
END
|