Looks for a time token in the ES12.4 format in the input string
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | str |
Input string |
Logical switch; true if string has time
pure function stringtool_obj_ContainsTime(str) result(val) !> Looks for a time token in the ES12.4 format in the input string character(len=*), intent(in) :: str !! Input string logical :: val !! Logical switch; true if string has time ! Work variables integer :: i, n val = .false. n = len(str) ! An ES12.4 string is 12 characters long. ! Example: 1.0000E+01 ! We look for the 'E' and check if the surrounding 12 chars fit the mold. do i = 1, n - 11 ! Check for decimal at index i+1 and 'E' at index i+6 if (str(i+1:i+1) == '.' .and. (str(i+6:i+6) == 'E' .or. str(i+6:i+6) == 'e')) then ! Basic check for the sign after E if (str(i+7:i+7) == '+' .or. str(i+7:i+7) == '-') then val = .true. return end if end if end do return end function stringtool_obj_ContainsTime