ESMF_Config_pad Subroutine

private subroutine ESMF_Config_pad(string)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(inout) :: string

Source Code

    subroutine ESMF_Config_pad ( string )

!-------------------------------------------------------------------------!
! !ROUTINE:  ESMF_CONFIG_Pad() --- Pad strings.
! 
! !DESCRIPTION: 
!
!     Pads from the right with the comment character (\#). It also
!  replaces TAB's with blanks for convenience. This is a low level
!  i90 routine.
!
! !CALLING SEQUENCE: 
!
!      call ESMF_Config_pad ( string )
!
! !INPUT PARAMETERS: 
!
       character(*), intent(inout) :: string       ! input string

! !OUTPUT PARAMETERS:            ! modified string
!
!      character(*), intent(inout) :: string
!
! !BUGS:  
!
!      It alters TAB's even inside strings.
!
!
! !REVISION HISTORY: 
!
!  19Jun96   da Silva   Original code.
!-------------------------------------------------------------------------

      integer :: i

!     Pad end of string with #
!     ------------------------
      do i = len (string), 1, -1 
         if ( string(i:i) .ne. ' ' .and. &
            string(i:i) .ne. '$' ) exit
         string(i:i) = '#'
      end do

!     Replace TAB's with blanks
!     -------------------------
      do i = 1, len (string)
         if ( string(i:i) .eq. TAB ) string(i:i) = BLK
         if ( string(i:i) .eq. '#' ) exit
      end do

    end subroutine ESMF_Config_pad