1Tcl_StringMatch(3) Tcl Library Procedures Tcl_StringMatch(3)
2
3
4
5______________________________________________________________________________
6
8 Tcl_StringMatch, Tcl_StringCaseMatch - test whether a string matches a
9 pattern
10
12 #include <tcl.h>
13
14 int
15 Tcl_StringMatch(string, pattern)
16
17 int
18 Tcl_StringCaseMatch(string, pattern, nocase)
19
21 char *string (in) String to test.
22
23 char *pattern (in) Pattern to match against
24 string. May contain special
25 characters from the set
26 *?\[].
27
28 int nocase (in) Specifies whether the match
29 should be done case-sensitive
30 (0) or case-insensitive (1).
31_________________________________________________________________
32
33
35 This utility procedure determines whether a string matches a given pat‐
36 tern. If it does, then Tcl_StringMatch returns 1. Otherwise
37 Tcl_StringMatch returns 0. The algorithm used for matching is the same
38 algorithm used in the ``string match'' Tcl command and is similar to
39 the algorithm used by the C-shell for file name matching; see the Tcl
40 manual entry for details. │
41
42 In Tcl_StringCaseMatch, the algorithm is the same, but you have the │
43 option to make the matching case-insensitive. If you choose this (by │
44 passing nocase as 1), then the string and pattern are essentially │
45 matched in the lower case.
46
47
49 match, pattern, string
50
51
52
53Tcl 8.1 Tcl_StringMatch(3)