subroutineparse_bool
subroutine parse_bool(text, value, ok)
Read true or false, in any case.
Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
| text | character(len=*) | in | the text | |
| value | logical | out | the value | |
| ok | logical | out | false if |
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