| 1 |
'\" |
| 2 |
'\" Copyright (c) 1989-1993 The Regents of the University of California. |
| 3 |
'\" Copyright (c) 1994-1996 Sun Microsystems, Inc. |
| 4 |
'\" |
| 5 |
'\" See the file "license.terms" for information on usage and redistribution |
| 6 |
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 7 |
'\" |
| 8 |
.TH Tcl_StringMatch 3 8.5 Tcl "Tcl Library Procedures" |
| 9 |
.so man.macros |
| 10 |
.BS |
| 11 |
.SH NAME |
| 12 |
Tcl_StringMatch, Tcl_StringCaseMatch \- test whether a string matches a pattern |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
\fB#include <tcl.h>\fR |
| 16 |
.sp |
| 17 |
int |
| 18 |
\fBTcl_StringMatch\fR(\fIstr\fR, \fIpattern\fR) |
| 19 |
.sp |
| 20 |
int |
| 21 |
\fBTcl_StringCaseMatch\fR(\fIstr\fR, \fIpattern\fR, \fIflags\fR) |
| 22 |
.SH ARGUMENTS |
| 23 |
.AS "const char" *pattern |
| 24 |
.AP "const char" *str in |
| 25 |
String to test. |
| 26 |
.AP "const char" *pattern in |
| 27 |
Pattern to match against string. May contain special |
| 28 |
characters from the set *?\e[]. |
| 29 |
.AP int flags in |
| 30 |
OR-ed combination of match flags, currently only \fBTCL_MATCH_NOCASE\fR. |
| 31 |
0 specifies a case-sensitive search. |
| 32 |
.BE |
| 33 |
|
| 34 |
.SH DESCRIPTION |
| 35 |
.PP |
| 36 |
This utility procedure determines whether a string matches |
| 37 |
a given pattern. If it does, then \fBTcl_StringMatch\fR returns |
| 38 |
1. Otherwise \fBTcl_StringMatch\fR returns 0. The algorithm |
| 39 |
used for matching is the same algorithm used in the \fBstring match\fR |
| 40 |
Tcl command and is similar to the algorithm used by the C-shell |
| 41 |
for file name matching; see the Tcl manual entry for details. |
| 42 |
.PP |
| 43 |
In \fBTcl_StringCaseMatch\fR, the algorithm is |
| 44 |
the same, but you have the option to make the matching case-insensitive. |
| 45 |
If you choose this (by passing \fBTCL_MATCH_NOCASE\fR), then the string and |
| 46 |
pattern are essentially matched in the lower case. |
| 47 |
|
| 48 |
.SH KEYWORDS |
| 49 |
match, pattern, string |