Returns the format statement from a line in a .GEO gravity coefficient file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | str | |||
character(len=*), | intent(out) | :: | fmt |
subroutine get_format_statement(str,fmt) implicit none character(len=*),intent(in) :: str character(len=*),intent(out) :: fmt integer :: i1,i2 !note: other text after the format statement is ignored i1 = index(str,'(') i2 = index(str,')') if (i1/=0 .and. i2/=0 .and. i2>i1) then fmt = str(i1:i2) else write(*,*) 'ERROR: THE STRING DOES NOT CONTAIN A FORMAT STATEMENT: '//trim(str) fmt = '' end if end subroutine get_format_statement