| matchi |
|
Table of contents
Procedure
MATCHI ( Match string against wildcard template )
LOGICAL FUNCTION MATCHI ( STRING, TEMPL, WSTR, WCHR )
Abstract
Determine whether a string is matched by a template containing
wild cards. This routine is case-insensitive.
Required_Reading
None.
Keywords
CHARACTER
COMPARE
Declarations
IMPLICIT NONE
CHARACTER*(*) STRING
CHARACTER*(*) TEMPL
CHARACTER*1 WSTR
CHARACTER*1 WCHR
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 .TRUE. if STRING matches TEMPL and otherwise
returns .FALSE.
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 .TRUE. when the input string matches the
input template, and .FALSE. 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
Error free.
Files
None.
Particulars
MATCHI ignores leading and trailing blanks in both the string
and the template. All of the following are equivalent (they
all return .TRUE.).
MATCHI ( 'ALCATRAZ', 'A*Z', '*', '%' )
MATCHI ( ' ALCATRAZ ', 'A*Z', '*', '%' )
MATCHI ( 'ALCATRAZ', ' A*Z ', '*', '%' )
MATCHI ( ' ALCATRAZ ', ' A*Z ', '*', '%' )
MATCHI 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 is T
'A%D*' F
'A%C*' T
'%A*' F
'%%CD*Z' T
'%%CD' F
'A*MN*Y*Z' T
'A*MN*Y*%Z' F
'*BCD*Z*' T
'*bdc*z*' F
' *bcD*Z* ' T
Restrictions
None.
Literature_References
None.
Author_and_Institution
N.J. Bachman (JPL)
J. Diaz del Rio (ODC Space)
W.L. Taber (JPL)
Version
SPICELIB Version 1.4.0, 17-JUN-2021 (JDR)
Added IMPLICIT NONE statement.
Edited the header to comply with NAIF standard.
SPICELIB Version 1.3.1, 11-NOV-2005 (NJB)
Corrected example calls in header; made other minor
edits to header.
SPICELIB Version 1.1.0, 08-JUN-1999 (WLT)
Fixed comments in detailed output and example sections.
SPICELIB Version 1.0.0, 01-DEC-1995 (WLT)
|
Fri Dec 31 18:36:33 2021