ESMF_UtilStringLowerCase Function

public function ESMF_UtilStringLowerCase(string, keywordEnforcer, rc)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: string
type(ESMF_KeywordEnforcer), optional :: keywordEnforcer
integer, intent(out), optional :: rc

Return Value character(len=len(string))


Source Code

    function ESMF_UtilStringLowerCase(string, keywordEnforcer, rc) 
!
! !ARGUMENTS:
      character(len=*), intent(in) :: string
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
      integer, intent(out), optional  :: rc  
! !RETURN VALUE:
      character(len (string)) :: ESMF_UtilStringLowerCase

!
! !DESCRIPTION:
!   Converts given string to lowercase.
!
!     The arguments are:
!     \begin{description}
!     \item[string]
!       A character string.
!     \item[{[rc]}]
!       Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
!     \end{description}
!
!
!EOP

      integer :: i
      character(len=1) :: c
      integer, parameter :: shift = ichar('a') - ichar('A')

      do i = 1, len(string)
        c = string(i:i)
        if(c >= 'A' .and. c <= 'Z') then
          c = char(ichar(c) + shift)
        endif
        ESMF_UtilStringLowerCase(i:i) = c
      enddo

      if (present(rc)) rc = ESMF_SUCCESS

      end function ESMF_UtilStringLowerCase