SUBROUTINE FINDLASTCHAR(nspace,carray,maxspace) C FINDLASTCHAR FINDS THE LOCATION OF THE LAST NON-BLANK C IN A CHARACTER STRING cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c Passed Variables: c c nspace - distance, in characters, from the beginning of c the character string where the last non-blank c character is found c carray - character string to be examined c maxspace - maximum number of characters in character array c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc character*(*) carray cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c Initialize nspace c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc nspace=-1 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c Look at each character in string. If a character is a blank c set the value of nspace. If a nonblank character is found, c nspace is set to zero. c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc do 50 n=1,maxspace c write(6,*) 'x50',n,'|',carray(n:n),'|' c if ( carray(n:n) .eq. CHAR(0) ) then i=isitreturn(carray(n:n)) if ( i .eq. 1 ) then if ( nspace .eq. 0 ) then nspace=n endif goto 4 endif if ( carray(n:n) .eq. " " .and. nspace .eq. 0 ) nspace=n if ( carray(n:n) .ne. " ") nspace=0 50 continue 4 continue cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc c c If a blank is not found, set nspace to maxspace. c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc if ( nspace.eq.0 ) nspace=maxspace+1 if ( nspace .eq. -1 ) nspace=1 nspace=nspace-1 return end