|
wcmatch - AutoCAD AutoLISP functionwcmatch is an AutoLISP function that performs a wild-card pattern match on a string. Syntax: (wcmatch string pattern) Where the arguments are string an pattern: Both arguments can be either a quoted string or a string variable. It is valid to use variables and values returned from AutoLISP functions for string and pattern values. Return Values
Examples The following example performs three comparisons. If
any of the three pattern conditions is met, wcmatch returns T. The tests
are: If any of the three pattern conditions is met,
wcmatch returns T: In this example, the last condition was met, so wcmatch returned T. Using Escape Characters with wcmatch Both the C and AutoLISP programming languages use the
backslash (\) as an escape character, so you need two backslashes (\\) to
produce one backslash in a string. To test for a backslash character
anywhere in “Name”, use the following function call: All characters enclosed in brackets ([ . . . ]) are
read literally, so there is no need to escape them, with the following
exceptions: the tilde character (~) is read literally only when it is not
the first bracketed character (as in "[A~BC]"); otherwise, it is read as the
negation character, meaning that wcmatch should match all characters except
those following the tilde (as in "[~ABC]"). The dash character (-) is read
literally only when it is the first or last bracketed character (as in
"[-ABC]" or "[ABC-]") or when it follows a leading tilde (as in "[~-ABC]").
Otherwise, the dash character (-) is used within brackets to specify a range
of values for a specific character. The range works only for single
characters, so "STR[1-38]" matches STR1, STR2, STR3, and STR8, and "[A-Z]"
matches any single uppercase letter. Note! Because additional wild-card characters might be added in future releases of AutoLISP, it is a good idea to escape all nonalphanumeric characters in your pattern to ensure upward compatibility. JTB World's software for AutoCAD
Freeware for AutoCAD
More resources on JTB World
| |||||||||||||||||||||||||||||



