fold_ascii_lower Subroutine

public subroutine fold_ascii_lower(text, out)

Lowercases ASCII letters. A local copy rather than parquet_to_lower, because that one lives in parquet_core, which uses THIS module -- importing it back would be a circular dependency.

Arguments

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

input text.

character(len=:), intent(out), allocatable :: out

text with every ASCII A-Z lowercased.


Source Code

    subroutine fold_ascii_lower(text, out)
        character(len=*), intent(in) :: text !! input text.
        character(len=:), allocatable, intent(out) :: out !! text with every ASCII A-Z lowercased.
        integer :: k, ic

        out = text
        do k = 1, len(out)
            ic = iachar(out(k:k))
            if (ic >= iachar("A") .and. ic <= iachar("Z")) out(k:k) = achar(ic + 32)
        end do
    end subroutine fold_ascii_lower