Debian Codegraph @

packages/seacas/libraries/suplib/pckstr.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
7 C=======================================================================
8 SUBROUTINE PCKSTR (NSTR, STR)
9 C=======================================================================
10
11 C --*** PCKSTR *** (STRLIB) Remove all blanks from string
12 C -- Written by Amy Gilkey - revised 03/21/88
13 C --
14 C --PCKSTR removes all embedded blanks (left-justified) from an array
15 C --of strings.
16 C --
17 C --Parameters:
18 C -- NSTR - IN - the number of strings to be packed
19 C -- STR - IN/OUT - the array of strings, returned packed, may be up
20 C -- to 1024 characters long
21
22 INTEGER NSTR
23 CHARACTER*(*) STR(*)
24
25 PARAMETER (MXSTR = 1024)
26 CHARACTER*(MXSTR) TMPSTR
27
28 if (nstr .eq. 0) return
29
30 LSTR = LENSTR (STR)
31 if (lstr .gt. MXSTR) then
32 call prterr ('PROGRAM', 'String is too long in SQZSTR')
33 return
34 end if
35
36 DO 20 I = 1, NSTR
37 LSTR = LENSTR (STR(I))
38
39 IBLK = INDEX (STR(I), ' ')
40 10 CONTINUE
41 IF ((IBLK .GT. 0) .AND. (IBLK .LT. LSTR)) THEN
42 TMPSTR = STR(I)(IBLK+1:LSTR)
43 STR(I)(IBLK:LSTR) = TMPSTR
44 LSTR = LSTR - 1
45 IBLK = INDEX (STR(I), ' ')
46 GOTO 10
47 END IF
48
49 20 CONTINUE
50
51 RETURN
52 END