| 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 SQZSTR (STRING, LSTR) |
| 9 |
C======================================================================= |
| 10 |
|
| 11 |
C --*** SQZSTR *** (STRLIB) Remove extra blanks from string |
| 12 |
C -- Written by Amy Gilkey - revised 06/02/87 |
| 13 |
C -- |
| 14 |
C --SQZSTR deletes leading and extra blanks within a string. |
| 15 |
C --To prevent problems, an empty string is returned with a length of 1. |
| 16 |
C -- |
| 17 |
C --Parameters: |
| 18 |
C -- STRING - IN/OUT - the string to be compressed, returned, may be |
| 19 |
C -- up to 1024 characters long |
| 20 |
C -- LSTR - OUT - the new string length |
| 21 |
|
| 22 |
C --Routines Called: |
| 23 |
C -- LENSTR - (STRLIB) Find string length |
| 24 |
|
| 25 |
CHARACTER*(*) STRING |
| 26 |
INTEGER LSTR |
| 27 |
|
| 28 |
PARAMETER (MXSTR = 1024) |
| 29 |
CHARACTER*(MXSTR) TMPSTR |
| 30 |
|
| 31 |
LSTR = 1 |
| 32 |
IF (STRING .EQ. ' ') RETURN |
| 33 |
|
| 34 |
LSTR = LENSTR (STRING) |
| 35 |
if (lstr .gt. MXSTR) then |
| 36 |
call prterr ('PROGRAM', 'String is too long in SQZSTR') |
| 37 |
return |
| 38 |
end if |
| 39 |
|
| 40 |
IBLK = INDEX (STRING, ' ') |
| 41 |
100 CONTINUE |
| 42 |
IF ((IBLK .GT. 0) .AND. (IBLK .LE. LSTR)) THEN |
| 43 |
|
| 44 |
INOBLK = IBLK + 2 |
| 45 |
110 CONTINUE |
| 46 |
IF (STRING(INOBLK:INOBLK) .EQ. ' ') THEN |
| 47 |
INOBLK = INOBLK + 1 |
| 48 |
GOTO 110 |
| 49 |
END IF |
| 50 |
|
| 51 |
TMPSTR = STRING(INOBLK:LSTR) |
| 52 |
STRING(IBLK+1:LSTR) = TMPSTR |
| 53 |
LSTR = LSTR - (INOBLK-IBLK-1) |
| 54 |
IBLK = INDEX (STRING, ' ') |
| 55 |
GOTO 100 |
| 56 |
END IF |
| 57 |
|
| 58 |
IF (STRING(1:1) .EQ. ' ') THEN |
| 59 |
TMPSTR = STRING(2:LSTR) |
| 60 |
STRING(1:LSTR) = TMPSTR |
| 61 |
LSTR = LSTR - 1 |
| 62 |
END IF |
| 63 |
|
| 64 |
RETURN |
| 65 |
END |