search

The search() function searches a list for the first element that is found to match a specific pattern. The search is case sensitive and wildcard characters can be used within the pattern.

For more information on using wildcard characters, please see Other Programming Considerations and quote.

result = search (list1, pattern);
list1 Required. The list to search.
pattern Required. The pattern to search for.

An integer value is returned. If a match is found, then result contains the element number of the first pattern match in the list. If no match is found, result is set to -1.

In this example,

list1 = {"ADM1", "ADM2", "ADM3", "SYSADM1", "SYSADM2", "USER1", "USER2"};
result = search (list1, "SYS*");

result is set to 3 as list1[3] is the first element in the list to match the search pattern.

append(), insert(), join(), length(), range(), replace()