fdoc

subroutineparse_bool

subroutine parse_bool(text, value, ok)

Read true or false, in any case.

Arguments

NameTypeIntentAttributesDescription
textcharacter(len=*)in

the text

valuelogicalout

the value

oklogicalout

false if text is neither

Source

Show the code
subroutine parse_bool(text, value, ok)
    character(len=*), intent(in) :: text    !! the text
    logical, intent(out) :: value           !! the value
    logical, intent(out) :: ok              !! false if `text` is neither
    character(len=:), allocatable :: low

    low = lowercase(text)
    ok = low == 'true' .or. low == 'false'
    value = low == 'true'
end subroutine parse_bool

Graphs

Called by