wdcnt |
Table of contents
ProcedureWDCNT ( Word Count ) INTEGER FUNCTION WDCNT ( STRING ) AbstractReturn the number of words in a string. Required_ReadingNone. KeywordsSTRING WORD DeclarationsIMPLICIT NONE CHARACTER*(*) STRING Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- STRING I Input character string. The function returns the number of words in the input string STRING. Detailed_InputSTRING is the input string to be parsed. It contains some number of words, where a word is any string of consecutive non-blank characters delimited by a blank or by either end of the string. Detailed_OutputThe function returns the number of words in the input character string STRING. ParametersNone. ExceptionsError free. FilesNone. ParticularsWDCNT, like NTHWD and NEXTWD, is useful primarily for parsing input commands consisting of one or more words, where a word is defined to be any sequence of consecutive non-blank characters delimited by either a blank or by either end of the string. ExamplesThe following examples illustrate the use of WDCNT. WDCNT ( 'Now is the time' ) = 4 WDCNT ( ' for all ' ) = 2 WDCNT ( 'good,men.to_come' ) = 1 WDCNT ( ' ' ) = 0 RestrictionsNone. Literature_ReferencesNone. Author_and_InstitutionJ. Diaz del Rio (ODC Space) W.L. Taber (JPL) I.M. Underwood (JPL) E.D. Wright (JPL) VersionSPICELIB Version 1.2.0, 08-APR-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. SPICELIB Version 1.1.0, 10-JAN-2005 (EDW) Added logic to prevent the evaluation of STRING(LOC:LOC) if LOC exceeds the length of string. Functionally, the evaluation had no effect on WDCNT's output, but the NAG F95 compiler flagged the evaluation as an array overrun error. This occurred because given: A .AND. B NAG evaluates A then B then performs the logical comparison. SPICELIB Version 1.0.1, 10-MAR-1992 (WLT) Comment section for permuted index source lines was added following the header. SPICELIB Version 1.0.0, 31-JAN-1990 (IMU) |
Fri Dec 31 18:37:07 2021