FindStrings()
Summary
Finds strings in an array that match one or more search specs.
Syntax
a = FindStrings(array input_array, array specs_array, array options)
| Argument | Contents |
|---|---|
| input_array | An array of strings to be searched |
| specs_array | An array of search specs, each an array of one or more search strings |
No options are currently supported.
Returns
An array with an index (0 if not found) for each search spec, even if input_array is null, or null if specs_array is null.
Notes
-
Each search string must start with "=" for an exact match, "<" to match the start of the string, or ">" to match any part of the string.
-
The search strings in a search spec are tried one by one on each string in input_array. The index is returned for the first string in input_array that matches any of the search strings.
-
If no string in input_array matches any of the search strings in a search spec, the index 0 is returned for that search spec.
-
All comparisons are case-insensitive.
-
FindStrings() does not search nested arrays.
Example
result = FindStrings({"alpha", "zipcode", "zip"},
{ {"<z", ">a"}, {"=gamma", "<code", "=AlpHa"} }, )
// result = { 2, 1}
Error Codes
No error will be returned.
See Also
| Function | Summary |
|---|---|
| ArrayPosition() | Finds the position of a sub-array in an array |
| Subarray() | Extracts a number of elements from an array |