Takes a string and converts to lowercase characters
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | string |
function utility_lowercase(string)!
!=================================!
! !
!! Takes a string and converts to
!! lowercase characters
! !
!=================================!
use w90_io, only: maxlen
implicit none
character(len=*), intent(in) :: string
character(len=maxlen) :: utility_lowercase
integer :: iA, iZ, idiff, ipos, ilett
iA = ichar('A')
iZ = ichar('Z')
idiff = iZ - ichar('z')
utility_lowercase = string
do ipos = 1, len(string)
ilett = ichar(string(ipos:ipos))
if ((ilett .ge. iA) .and. (ilett .le. iZ)) &
utility_lowercase(ipos:ipos) = char(ilett - idiff)
enddo
utility_lowercase = trim(adjustl(utility_lowercase))
return
end function utility_lowercase