SUBROUTINE ST_LDSP ( string, outstr, ncout, iret ) C************************************************************************ C* ST_LDSP * C* * C* This subroutine deletes the leading spaces and tabs in a string. * C* The input and output strings may be the same variable. * C* * C* ST_LDSP ( STRING, OUTSTR, NCOUT, IRET ) * C* * C* Input parameters: * C* STRING CHAR* String * C* * C* Output parameters: * C* OUTSTR CHAR* Output string * C* NCOUT INTEGER Number of characters output * C* IRET INTEGER Return code * C* 0 = normal return * C** * C* Log: * C* I. Graffman/RDS 2/84 Use new GEMPAK routines * C* M. desJardins/GSFC 11/84 Fixed * C* M. desJardins/GSFC 6/88 Documentation * C* L. Sager/NCEP 2/96 Increased size of stbuf * C* D. Kidwell/NCEP 10/96 Ported to Cray * C* K. Brill/HPC 6/99 Assign character constants * C************************************************************************ C* CHARACTER*(*) string, outstr C* CHARACTER stbuf*160, c*1, CHSPAC*1, CHTAB*1, CHNULL*1 C*------------------------------------------------------------------------- stbuf = string CHSPAC = CHAR (32) CHTAB = CHAR (9) CHNULL = CHAR (0) iret = 0 C C* Get length of string. C CALL ST_LSTR ( stbuf, lens, iret ) C C* If length is non-zero, find first non space. C IF ( lens .eq. 0 ) THEN ncout = 0 outstr = ' ' ELSE jp = 1 c = stbuf ( jp:jp ) C DO WHILE ( ( ( c .eq. CHSPAC ) .or. ( c .eq. CHTAB ) .or. + ( c .eq. CHNULL ) ) .and. ( jp .le. lens ) ) jp = jp + 1 IF ( jp .le. lens ) c = stbuf ( jp:jp ) ENDDO C C* Compute length and fill output string. C ncout = lens - jp + 1 IF ( ncout .gt. 0 ) THEN outstr = stbuf ( jp : lens ) ELSE outstr = ' ' END IF ENDIF C* RETURN END