Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
ncposr_c

Table of contents
Procedure
Abstract
Required_Reading
Keywords
Brief_I/O
Detailed_Input
Detailed_Output
Parameters
Exceptions
Files
Particulars
Examples
Restrictions
Literature_References
Author_and_Institution
Version
Index_Entries

Procedure

   ncposr_c ( Character position, reverse ) 

   SpiceInt ncposr_c ( ConstSpiceChar    * str,
                       ConstSpiceChar    * chars,
                       SpiceInt            start  )

Abstract

   Find 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_Reading

   SCANNING

Keywords

   CHARACTER
   SEARCH
   UTILITY


Brief_I/O

   VARIABLE  I/O  DESCRIPTION
   --------  ---  --------------------------------------------------
   str        I   Any character string.
   chars      I   A collection of characters.
   start      I   Position to begin looking for one of 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_Input

   str         is any character string.

   chars       is a character string containing a collection
               of characters. Spaces in chars are significant,
               including trailing blanks. The order in which
               characters are listed is not significant.

   start       is the position in str to begin looking for one of
               the characters in chars. start may range from 0
               to n-1, where n is the number of characters in str.

Detailed_Output

   The 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. The returned value normally ranges from 0 to n-1, where n is
   the number of characters in str. If none of the characters is found,
   the function returns -1.

Parameters

   None.

Exceptions

   1)  If `start' is less than 0, ncposr_c returns -1.

   2)  If `start' is greater than strlen(str), the search begins
       at the last character of the string.

   3)  If any of the `str' or `chars' input string pointers is null,
       the error SPICE(NULLPOINTER) is signaled. The function returns
       the value -1.

   4)  If any of the `str' or `chars' input string has zero length,
       the function returns the value -1. This case is not considered
       an error.

Files

   None.

Particulars

   ncposr_c is case sensitive.

   An entire family of related CSPICE routines

      cpos_c
      cposr_c
      ncpos_c
      ncposr_c
      pos_c
      posr_c

   is described in the Required Reading.

Examples

   Let string == "BOB, JOHN, TED, AND MARTIN...."
                  012345678901234567890123456789

   Let chars  == "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

   Normal (sequential) searching:
   ------------------------------

     ncposr_c( string, ' ,',    29 ) = 29
     ncposr_c( string, ' ,',    28 ) = 28
     ncposr_c( string, ' ,',    27 ) = 27
     ncposr_c( string, ' ,',    26 ) = 26
     ncposr_c( string, ' ,',    25 ) = 19
     ncposr_c( string, ' ,',    18 ) = 15
     ncposr_c( string, ' ,',    14 ) = 14
     ncposr_c( string, ' ,',    13 ) = 10
     ncposr_c( string, ' ,',     9 ) =  9
     ncposr_c( string, ' ,',     8 ) =  4
     ncposr_c( string, ' ,',     3 ) =  3
     ncposr_c( string, ' ,',     2 ) = -1


   start out of bounds:
   --------------------

     ncposr_c( string, ' ,',    -1 ) = -1
     ncposr_c( string, ' ,',    -5 ) = -1
     ncposr_c( string, ' ,',    30 ) = 29
     ncposr_c( string, ' ,',   122 ) = 29

Restrictions

   None.

Literature_References

   None.

Author_and_Institution

   N.J. Bachman        (JPL)
   J. Diaz del Rio     (ODC Space)
   W.L. Taber          (JPL)

Version

   -CSPICE Version 1.0.1, 04-AUG-2021 (JDR)

       Edited the header to comply with NAIF standard.

   -CSPICE Version 1.0.0, 27-AUG-2002 (NJB) (WLT)

Index_Entries

   backward search for position of unlisted character
Fri Dec 31 18:41:10 2021