ncposr |
Table of contents
ProcedureNCPOSR (NOT character position, reverse) INTEGER FUNCTION NCPOSR ( STR, CHARS, START ) AbstractFind the first occurrence in a string of a character NOT belonging to a collection of characters, starting at a specified location, searching in reverse. Required_ReadingSCANNING KeywordsCHARACTER SEARCH UTILITY DeclarationsIMPLICIT NONE CHARACTER*(*) STR CHARACTER*(*) CHARS INTEGER START Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- STR I Any character string. CHARS I A collection of characters. START I Position to begin looking for one not in CHARS The function returns the index of the last character of STR at or before index START that is not in the collection CHARS. Detailed_InputSTR is any character string. CHARS is a character string containing a collection of characters. Spaces in CHARS are significant. START is the position in STR to begin looking for characters not in CHARS. Detailed_OutputThe function returns the index of the last character of STR (at or before index START) that is not one of the characters in the string CHARS. No such character is found, the function returns zero. ParametersNone. ExceptionsError free. 1) If START is less than 1, NCPOSR returns zero. 2) If START is greater than LEN(STRING), the search begins at the last character of the string. FilesNone. ParticularsNCPOSR is case sensitive. An entire family of related SPICELIB routines (POS, CPOS, NCPOS, POSR, CPOSR, NCPOSR) is described in the Required Reading. Those familiar with the True BASIC language should note that these functions are equivalent to the True BASIC intrinsic functions with the same names. ExamplesLet STRING = 'BOB, JOHN, TED, AND MARTIN ' 123456789012345678901234567890 Let CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' Normal (Sequential) Searching: ------------------------------ NCPOSR( STRING, CHAR, 31 ) = 30 NCPOSR( STRING, CHAR, 29 ) = 29 NCPOSR( STRING, CHAR, 28 ) = 28 NCPOSR( STRING, CHAR, 27 ) = 27 NCPOSR( STRING, CHAR, 26 ) = 20 NCPOSR( STRING, CHAR, 19 ) = 16 NCPOSR( STRING, CHAR, 15 ) = 15 NCPOSR( STRING, CHAR, 14 ) = 11 NCPOSR( STRING, CHAR, 10 ) = 10 NCPOSR( STRING, CHAR, 9 ) = 5 NCPOSR( STRING, CHAR, 4 ) = 4 NCPOSR( STRING, CHAR, 3 ) = 0 START out of bounds: -------------------- NCPOSR( STRING, CHAR, 0 ) = 0 NCPOSR( STRING, CHAR, -4 ) = 0 NCPOSR( STRING, CHAR, 31 ) = 30 NCPOSR( STRING, CHAR, 123 ) = 30 Order within CHARS: ------------------- NCPOSR( STRING, 'JOHN', 7 ) = 5 NCPOSR( STRING, 'OHJN', 7 ) = 5 RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) H.A. Neilan (JPL) B.V. Semenov (JPL) W.L. Taber (JPL) VersionSPICELIB Version 1.1.0, 13-AUG-2021 (JDR) Edited the header to comply with NAIF standard. SPICELIB Version 1.0.3, 31-JAN-2008 (BVS) Removed non-standard end-of-declarations marker 'C%&END_DECLARATIONS' from comments. SPICELIB Version 1.0.2, 10-MAR-1992 (WLT) Comment section for permuted index source lines was added following the header. SPICELIB Version 1.0.1, 26-MAR-1991 (HAN) The Required Reading file POSITION was renamed to SCANNING. This header was updated to reflect the change. SPICELIB Version 1.0.0, 31-JAN-1990 (WLT) |
Fri Dec 31 18:36:35 2021