Return 1-based list position typed in s.
0 if s is not a plain number of at most 6 digits.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | s |
Typed selector. |
pure integer(int32) function list_index(s) !! Return 1-based list position typed in `s`. !! !! 0 if `s` is not a plain number of at most 6 digits. ! Arguments character(len=*), intent(in) :: s !! Typed selector. integer(int32) :: ios list_index = 0 if (len_trim(s) == 0 .or. len_trim(s) > 6) return if (verify(trim(s), '0123456789') /= 0) return read (s, *, iostat=ios) list_index if (ios /= 0) list_index = 0 end function list_index