C+ C NAME: C Str2Flt_CheckNext C PURPOSE: C (Internal use by Str2Flt only) C Checks whether character following char I in string Str is present in Valid. C CALLING SEQUENCE: logical function Str2Flt_CheckNext(nLen,cStr,nMask,cMask,I,CH,cValid,iFirst) C INPUTS: C nLen integer effective length of cStr C cStr character*(*) string C nMask C cMask C I integer C CH character C cValid character*(*) C iFirst integer C OUTPUTS: C Str2Flt_CheckNext C logical C I integer C CH character C iFirst integer C PROCEDURE: C Called when CH = cStr(I:I) is a '+', '-' or dot. To be part of a valid C number the char following I must be a dot or digit (if CH = '+' or '-') or C it must be a digit (if CH = '.'). C MODIFICATION HISTORY: C SEP-2002, Paul Hick (UCSD/CASS; pphick@ucsd.edu) C- integer nLen character cStr*(*) integer nMask character cMask(*) integer I character CH character cValid*(*) integer iFirst logical bMask bMask(I) = I .le. nMask .and. cMask(min(I,nMask)) .ne. '1' ! Statement function !------- ! Pick up next character (following +,- or . ! If no more characters, then return .FALSE. after clearing iFirst. I = I+1 Str2Flt_CheckNext = I .le. nLen if (Str2Flt_CheckNext) then CH = cStr(I:I) ! Char after be on Valid list if (bMask(I) .or. index(cValid,CH) .eq. 0) then I = I-1 ! If not valid, skip back to previous char CH = cStr(I:I) ! Retrieve +,- or . iFirst = 0 ! Necessary if '+.' or '-.' was found else !------- ! If CH on cValid list then we probably found the start of a number. ! Note that iFirst was set already when detecting a dot preceeded by + or -. if (iFirst .eq. 0) iFirst = I-1 end if else iFirst = 0 end if return end