lowercase a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str |
input string |
lowercase version of the string
pure function lowercase(str) result(s_lower) implicit none character(len=*),intent(in) :: str !! input string character(len=(len(str))) :: s_lower !! lowercase version of the string integer :: i !! counter integer :: j !! index of uppercase character character(len=*),parameter :: upper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' !! uppercase characters character(len=*),parameter :: lower = 'abcdefghijklmnopqrstuvwxyz' !! lowercase characters s_lower = str do i = 1, len_trim(str) j = index(upper,s_lower(i:i)) if (j>0) s_lower(i:i) = lower(j:j) end do end function lowercase