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
isrchc_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

   isrchc_c ( Search in a character array ) 

   SpiceInt isrchc_c ( ConstSpiceChar  * value,
                       SpiceInt          ndim,
                       SpiceInt          arrlen,
                       const void      * array   )

Abstract

   Search for a given value within a character string array. Return
   the index of the first matching array entry, or -1 if the key
   value was not found.

Required_Reading

   None.

Keywords

   ARRAY
   SEARCH


Brief_I/O

   VARIABLE  I/O  DESCRIPTION
   --------  ---  --------------------------------------------------
   value      I   Key value to be found in array.
   ndim       I   Dimension of array.
   arrlen     I   String length.
   array      I   Character string array to search.

   The function returns the index of the first matching array
   element or -1 if the value is not found.

Detailed_Input

   value       is the key value to be found in the array. Trailing
               blanks in this key are not significant: string matches
               found by this routine do not require trailing blanks in
               value to match those in the corresponding element of
               array.

               The input key `value' may have length zero.

   ndim        is the dimension of the array.

   arrlen      is the declared length of the strings in the input
               string array, including null terminators. The input
               array should be declared with dimension

                  [ndim][arrlen]

   array       is the array of character strings to be searched. Trailing
               blanks in the strings in this array are not significant.

Detailed_Output

   The function returns the index of the first matching array
   element in array. If value is not found, isrchc_c returns -1.

Parameters

   None.

Exceptions

   1)  If ndim < 1, the function value is -1.

   2)  If the `value' input string pointer is null, the error
       SPICE(NULLPOINTER) is signaled. The function returns the value
       -1.

   3)  If the `array' input array pointer is null, the error
       SPICE(NULLPOINTER) is signaled. The function returns the value
       -1.

   4)  If the `array' input array strings have length less than two
       characters, the error SPICE(STRINGTOOSHORT) is signaled. The
       function returns the value -1.

Files

   None.

Particulars

   None.

Examples

   The following table shows the value of isrchc_c given the contents
   of array and value:

      array                 value     isrchc_c
    -----------------       -----     --------
    "1", "0", "4", "2"       "4"          2
    "1", "0", "4", "2"       "2"          3
    "1", "0", "4", "2"       "3"         -1

Restrictions

   1)  String comparisons performed by this routine are Fortran-style:
       trailing blanks in the input array or key value are ignored.
       This gives consistent behavior with CSPICE code generated by
       the f2c translator, as well as with the Fortran SPICE Toolkit.

       Note that this behavior is not identical to that of the ANSI
       C library functions strcmp and strncmp.

Literature_References

   None.

Author_and_Institution

   N.J. Bachman        (JPL)
   J. Diaz del Rio     (ODC Space)
   W.M. Owen           (JPL)

Version

   -CSPICE Version 1.2.0, 03-AUG-2021 (JDR)

       Changed the input argument name "lenvals" to "arrlen" for consistency
       with other routines.

       Edited the header to comply with NAIF standard.

       Removed entry #3 from -Exceptions section and edited the description of
       "value" in -Detailed_Input to indicate that empty string values are
       allowed.

   -CSPICE Version 1.1.0, 07-MAR-2009 (NJB)

       This file now includes the header file f2cMang.h.
       This header supports name mangling of f2c library
       functions.

       Header sections were re-ordered.

   -CSPICE Version 1.0.0, 22-JUL-2002 (NJB) (WMO)

Index_Entries

   search in a character array
Fri Dec 31 18:41:08 2021