What\\\'s the difference between match(), member() and strmatch()?

Submitted by javelin on Sun, 2012-02-12 22:15

What\\\'s the difference between match(), member() and strmatch()?

match(list, wildcard pattern[, delimiter])
member(list, element[, delimiter])
strmatch(string, wildcardpattern)

match() and member() are list functions that look for a matching element in a list and return its position in the list, or 0 if it\\\'s not found. member() does case-sensitive exact matches, which makes it good for things like dbrefs. match() is case-insensitive, and does wildcard matching (* and ?), so it can be used to find things like the first element of the list starting with the letter F (or f).

strmatch(), on the other hand, is a string function. Instead of treating its first argument as a list to be broken up into individual elements to look at, it compares the entire argument at once against the wildcard pattern, and returns 1 if it matches, 0 if not.

2001-Oct-22 6:52pm shawnw