matchi_c

Index Page matchi_c
A B C D E F G H I J K L M N O P Q R S T U V W X
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
       SpiceBoolean matchi_c ( ConstSpiceChar      * string,
                               ConstSpiceChar      * templ,
                               SpiceChar             wstr,
                               SpiceChar             wchr   )
#### Abstract
        Determine whether a string is matched by a template containing
        wild cards.  The pattern comparison is case-insensitive.
#### Required_Reading
        None.
#### Keywords
        CHARACTER,  COMPARE
#### Brief_I/O
        VARIABLE  I/O  DESCRIPTION
        --------  ---  --------------------------------------------------
        string     I   String to be tested.
        templ      I   Template (with wild cards) to test against string.
        wstr       I   Wild string token.
        wchr       I   Wild character token.

        The function returns the value SPICETRUE if string matches templ,
        SPICEFALSE if not.
#### Detailed_Input
        string      is the input character string to be tested for
                    a match against the input template. Leading and
                    trailing blanks are ignored.

        templ       is the input template to be tested for a match
                    against the input string. TEMPL may contain wild
                    cards. Leading and trailing blanks are ignored.

        wstr        is the wild string token used in the input template.
                    The wild string token may represent from zero to
                    any number of characters.

        wchr        is the wild character token used in the input
                    template. The wild character token represents
                    exactly one character.
#### Detailed_Output
        The function returns SPICETRUE when the input string matches the
        input template, and SPICEFALSE otherwise. The string and template
        match whenever the template can expand (through replacement of its
        wild cards) to become the input string.
#### Parameters
       None.
#### Exceptions
       1) If either the input string pointer is null, the error
          SPICE(NULLPOINTER) will be signaled.  The function will
          return SPICEFALSE.

       2) If either input string has length zero, the error
          SPICE(EMPTYSTRING) will be signaled.  The function will
          return SPICEFALSE.
#### Files
        None.
#### Particulars
       matchi_c ignores leading and trailing blanks in both the string
       and the template. All of the following are equivalent:  they
       all return SPICETRUE.

          #include "SpiceUsr.h"
                .
                .
                .
          matchi_c ( "ALCATRAZ",       "A*Z",      '*', '%' );
          matchi_c ( "  ALCATRAZ  ",   "a*z",      '*', '%' );
          matchi_c ( "alcatraz",       "  A*Z  ",  '*', '%' );
          matchi_c ( "  ALCATRAZ  ",   "  A*Z  ",  '*', '%' );

       matchi_c is case-insensitive:  uppercase characters match
       lowercase characters, and vice versa.  Wild characters match
       characters of both cases.
#### Examples
       Let
             string  = "  ABCDEFGHIJKLMNOPQRSTUVWXYZ  "
             wstr    = '*'
             wchr    = '%'

       Then
             if TEMPL is  "*A*"        matchi_c is SPICETRUE
                          "A%D*"                     SPICEFALSE
                          "A%C*"                   SPICETRUE
                          "%A*"                      SPICEFALSE
                          "%%CD*Z"                 SPICETRUE
                          "%%CD"                     SPICEFALSE
                          "A*MN*Y*Z"               SPICETRUE
                          "A*MN*Y*%Z"                SPICEFALSE
                          "*BCD*Z*"                SPICETRUE
                          "*bdc*z*"                  SPICEFALSE
                          " *bcD*Z*  "             SPICETRUE
#### Restrictions
       None.
#### Literature_References
        None.
#### Author_and_Institution
        N.J. Bachman    (JPL)
        W.L. Taber      (JPL)
        I.M. Underwood  (JPL)
#### Version
       -CSPICE Version 1.0.0, 17-AUG-1999 (NJB) (WLT) (IMU)
#### Index_Entries
       match string against wildcard template
       test whether a string matches a wildcard template
#### Link to routine matchi_c source file matchi_c.c

    Thu Apr 16 08:58:35 2009