Debian Codegraph @

packages/seacas/libraries/supes/fre_fld/stripb.f

raw
1 C Copyright(C) 1999-2020 National Technology & Engineering Solutions
2 C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
3 C NTESS, the U.S. Government retains certain rights in this software.
4 C
5 C See packages/seacas/LICENSE for details
6 SUBROUTINE STRIPB( STRING,ILEFT,IRIGHT )
7 CHARACTER*(*) STRING
8
9 ************************************************************************
10
11 C FREFLD INPUT SYSTEM - ANSI FORTRAN - UTILITY ROUTINE
12
13 C DESCRIPTION:
14 C This routine strips leading and trailing blanks from a string. It
15 C does not modify or copy the string, but simply returns the
16 C location of the first and last non-blank characters. If the
17 C string is completely blank, ILEFT=LEN(STRING)+1 and IRIGHT=0 will
18 C be returned.
19
20 C FORMAL PARAMETERS:
21 C STRING CHARACTER Any character string.
22 C ILEFT INTEGER Position of first non-blank character.
23 C IRIGHT INTEGER Position of last non-blank character.
24
25 ************************************************************************
26
27 C ... Needed for 64-bit Solaris compile. Arg to CHAR must be
28 C an integer of correct size.
29
30 INTEGER TABC
31 TABC = 9
32
33 C Get length of the string -
34 LS = LEN( STRING )
35
36 C Find the first non-blank character -
37 DO 10 N = 1 , LS
38 IF ( STRING(N:N) .NE. ' '
39 $ .AND. STRING(N:N) .NE. CHAR(TABC) ) GO TO 15
40 10 CONTINUE
41 15 CONTINUE
42 ILEFT = N
43
44 C Find the last non-blank character -
45 DO 20 N = LS , 1 , -1
46 IF ( STRING(N:N) .NE. ' '
47 $ .AND. STRING(N:N) .NE. CHAR(TABC) ) GO TO 25
48 20 CONTINUE
49 25 CONTINUE
50 IRIGHT = N
51
52 END