This function determines whether the input character string can be parsed into an integer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | chara |
pure function is_integer (chara) result(res) use :: iso_fortran_env, only: int64 use :: forgex_parameters_m implicit none character(*), intent(in) :: chara integer :: ios, i, count integer(int64) :: val1 logical :: res i = index(chara, SYMBOL_COMMA) i = max(i, index(chara, SYMBOL_WS)) if (i /= 0) then res = .false. return end if read(chara, fmt='(1i19)', iostat=ios) val1 if (ios /= 0) then res = .false. else res = .true. end if end function is_integer