lowercase Function

private pure function lowercase(str) result(s_lower)

lowercase a string.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str

input string

Return Value character(len=len=(len(str)))

lowercase version of the string


Called by

proc~~lowercase~~CalledByGraph proc~lowercase root_module::lowercase proc~root_name_to_method root_module::root_name_to_method proc~root_name_to_method->proc~lowercase proc~root_scalar_by_name root_module::root_scalar_by_name proc~root_scalar_by_name->proc~root_name_to_method interface~root_scalar root_module::root_scalar proc~root_scalar_by_name->interface~root_scalar interface~root_scalar->proc~root_scalar_by_name proc~root_scalar_by_type root_module::root_scalar_by_type interface~root_scalar->proc~root_scalar_by_type proc~solve root_module::root_solver%solve proc~solve->interface~root_scalar proc~root_scalar_by_type->proc~solve

Source Code

    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