general/misc/
strfilter.pro
Routines
top source strfilter
result = strfilter(str, matchs, count=count, wildcard=wildcard, fold_case=fold_case, delimiter=delimiter, no_match=no_match, index=index, string=string, byte=byte, negate=negate)
FUNCTION: res = strfilter(stringarray,searchstring) PURPOSE: Returns the subset of stringarray that matchs searchstring '*' will match all (non-null) strings '' will match only the null string Output can be modified with keywords NOTE: this routine is very similar to the STRMATCH routine introduced in IDL 5.3 it has some enhancements that make it useful. (i.e.: filterstring can also be an array) INPUT: stringarray: An array of strings to be filtered searchstring: A string that may contain wildcard characters ("*") (If searchstring is an array then results are OR'd together) RETURN VALUE: Either: Array of matching strings. or: Array of string indices. or: Byte array with same dimension as input string. Depends upon keyword setting (See below) KEYWORDS: FOLD_CASE: if set then CASE is ignored. (only IDL 5.3 and later) STRING: if set then the matching strings are returned. (default) INDEX: if set then the indices are returned. BYTES: if set then a byte array is returned with same dimension as input string array (similar to STRMATCH). NEGATE: pass only strings that do NOT match. COUNT: A named variable that will contain the number of matched strings. NO_MATCH: A named variable that will contain either a subset of searchstring that failed to match stringarray, an array of indices to that subset, or a byte array whose dimensions match the number of elements in searchstring. The data type returned will match that of the return value. (only IDL 5.3 and later) Limitations: This function still needs modification to accept the '?' character July 2000; modified to use the IDL strmatch function so that '?' is accepted for versions > 5.4 EXAMPLE: Print,strfilter(findfile('*'),'*.pro',/negate) ; print all files that do NOT end in .pro AUTHOR: Davin Larson, Space Sciences Lab, Berkeley; Feb, 1999 VERSION: 01/10/08
Parameters
- str
- matchs
Keywords
- count
- wildcard
- fold_case
- delimiter
- no_match
- index
- string
- byte
- negate
File attributes
Modification date: | Thu Feb 13 16:43:48 2014 |
Lines: | 62 |