dxtrct |
Table of contents
ProcedureDXTRCT (Extract Double Precision Values From A String) SUBROUTINE DXTRCT ( KEYWD, MAXWDS , STRING, . NFOUND, PARSED, VALUES ) AbstractLocate a keyword and succeeding numeric words within a string. Parse and store the numeric words. Remove the keyword and numeric words from the input string. Required_ReadingNone. KeywordsPARSING WORD DeclarationsIMPLICIT NONE CHARACTER*(*) KEYWD INTEGER MAXWDS CHARACTER*(*) STRING INTEGER NFOUND INTEGER PARSED DOUBLE PRECISION VALUES ( * ) Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- KEYWD I Keyword used to mark start of a set of numbers. MAXWDS I Maximum number of numeric words that can be parsed STRING I-O String potentially containing KEYWD and numbers. NFOUND O Number of numeric words found following the KEYWD. PARSED O Number of numeric words translated and returned. VALUES O The double precision values for the numbers. Detailed_InputKEYWD is a word used to mark the start of a set of numeric words of interest. MAXWDS is the maximum number of numeric words that can be parsed and returned. STRING is a string potentially containing KEYWD and numbers. Detailed_OutputSTRING is the input string stripped of all parsed numeric words. If there was room available to parse all of the numeric words associated with KEYWD, the keyword that marked the beginning of the parsed numbers in the original string will also be removed. NFOUND is the number of numeric words that were found following KEYWD but preceding the next non-numeric word of the string. If the KEYWD is not present in the string, NFOUND is returned as -1. If the keyword is located but the next word in the string is non-numeric NFOUND will be returned as 0. PARSED is the number of numeric words that were actually parsed and stored in the output array VALUES. If no values are parsed PARSED is returned as 0. VALUES are the double precision values for the parsed numeric words that follow the first occurrence of the keyword but precede the next non-numeric word. ParametersNone. ExceptionsError free. FilesNone. ParticularsDefinitions: WORD is a set of consecutive non-blank characters delimited by blanks or the end of the string that contains them. NUMERIC WORD a word that can be parsed by the SPICELIB routine NPARSD without error. All FORTRAN numeric representations are numeric words. In addition 'PI', 'Pi', 'pI', and 'pi' are all recognized as having the value: 3.1415926535897932384626D0 See NPARSD FOR A a full description of legitimate numeric words. Given a string and a keyword this routine locates the first occurrence of the keyword in the string and returns the double precision representations of up to MAXWDS succeeding numeric words. All parsed numeric words are removed from the string. If every numeric word following KEYWD but preceding the next non-numeric word is parsed, KEYWD will also be removed from the string. If the keyword cannot be located in the string, the variable NFOUND will be returned as -1 and the string will be unchanged. In all other cases, some part of the string (possibly all of it) will be removed. ExamplesInput STRING 'LONGITUDE 39.2829 LATITUDE 24.27682' KEYWD 'LONGITUDE' MAXWDS 4 Output: STRING ' LATITUDE 24.27682' NFOUND 1 PARSED 1 VALUES 3.92829D+01 Input STRING 'THIS IS A BAD STRING FOR NUMBERS' KEYWD 'RADIUS' MAXWDS 2 Output: STRING 'THIS IS A BAD STRING FOR NUMBERS' NFOUND -1 PARSED 0 VALUES (unchanged) Input STRING 'PRIMES 11 13 17 19 23 NON-PRIMES 12 14 15' KEYWD 'PRIMES' MAXWDS 3 Output: STRING 'PRIMES 19 23 NON-PRIMES 12 14 15' NFOUND 5 PARSED 3 VALUES 1.1D+01 1.3D+01 1.7D+01 Input STRING 'PRIMES 11 13 17 19 23 NON-PRIMES 12 14 15' KEYWD 'PRIMES' MAXWDS 5 Output: STRING ' NON-PRIMES 12 14 15' NFOUND 5 PARSED 5 VALUES 1.1D+01 1.3D+01 1.7D+01 1.9D+01 2.3D+01 RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) H.A. Neilan (JPL) W.L. Taber (JPL) I.M. Underwood (JPL) VersionSPICELIB Version 1.2.0, 05-JUN-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. SPICELIB Version 1.1.1, 10-MAR-1992 (WLT) Comment section for permuted index source lines was added following the header. SPICELIB Version 1.1.0, 23-MAY-1990 (HAN) The variable FOUND was changed to NFOUND. SPICELIB Version 1.0.0, 31-JAN-1990 (WLT) (IMU) |
Fri Dec 31 18:36:17 2021