[25] | 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 | '\" RCS: @(#) $Id: StrMatch.3,v 1.14 2007/12/13 15:22:32 dgp Exp $ |
---|
| 9 | '\" |
---|
| 10 | .so man.macros |
---|
| 11 | .TH Tcl_StringMatch 3 8.5 Tcl "Tcl Library Procedures" |
---|
| 12 | .BS |
---|
| 13 | .SH NAME |
---|
| 14 | Tcl_StringMatch, Tcl_StringCaseMatch \- test whether a string matches a pattern |
---|
| 15 | .SH SYNOPSIS |
---|
| 16 | .nf |
---|
| 17 | \fB#include <tcl.h>\fR |
---|
| 18 | .sp |
---|
| 19 | int |
---|
| 20 | \fBTcl_StringMatch\fR(\fIstr\fR, \fIpattern\fR) |
---|
| 21 | .sp |
---|
| 22 | int |
---|
| 23 | \fBTcl_StringCaseMatch\fR(\fIstr\fR, \fIpattern\fR, \fIflags\fR) |
---|
| 24 | .SH ARGUMENTS |
---|
| 25 | .AS "const char" *pattern |
---|
| 26 | .AP "const char" *str in |
---|
| 27 | String to test. |
---|
| 28 | .AP "const char" *pattern in |
---|
| 29 | Pattern to match against string. May contain special |
---|
| 30 | characters from the set *?\e[]. |
---|
| 31 | .AP int flags in |
---|
| 32 | OR-ed combination of match flags, currently only \fBTCL_MATCH_NOCASE\fR. |
---|
| 33 | 0 specifies a case-sensitive search. |
---|
| 34 | .BE |
---|
| 35 | |
---|
| 36 | .SH DESCRIPTION |
---|
| 37 | .PP |
---|
| 38 | This utility procedure determines whether a string matches |
---|
| 39 | a given pattern. If it does, then \fBTcl_StringMatch\fR returns |
---|
| 40 | 1. Otherwise \fBTcl_StringMatch\fR returns 0. The algorithm |
---|
| 41 | used for matching is the same algorithm used in the \fBstring match\fR |
---|
| 42 | Tcl command and is similar to the algorithm used by the C-shell |
---|
| 43 | for file name matching; see the Tcl manual entry for details. |
---|
| 44 | .PP |
---|
| 45 | In \fBTcl_StringCaseMatch\fR, the algorithm is |
---|
| 46 | the same, but you have the option to make the matching case-insensitive. |
---|
| 47 | If you choose this (by passing \fBTCL_MATCH_NOCASE\fR), then the string and |
---|
| 48 | pattern are essentially matched in the lower case. |
---|
| 49 | |
---|
| 50 | .SH KEYWORDS |
---|
| 51 | match, pattern, string |
---|