
Filter
Filter(inString, searchString)
This function is designed to search the string in the specified strings. It searches an array of strings for a specified string, and returns the strings in an array.
Overloads
- Filter(inString, searchString)
- Filter(inString, searchString, include)
- Filter(inString, searchString, include, compare)
Parameters
- inString - An array of string which you want to find the search string from.
- searchString - A String which you want to search for.
- include - An optional Boolean value indicating whether to return substrings that include or exclude searchString. If include is True, Filter returns the subset of the array that contains searchString as a substring. If include is False, Filter returns the subset of the array that does not contain searchString as a substring. If omitted, the value True will be used.
- compare - An optional Number value indicating the kind of string comparison to use,
- 0 performs a comparison that is case sensitive.
- 1 performs a comparison that is case insensitive.
- If omitted, a case sensitive comparison is performed.
Return value
Array of String values.
Examples
Suppose that inString = [ "abc", "Abc", "abcdfg", "asdfabc", "sdfdfd"], searchString = "abc"
filter(inStrings, searchString) - Returns ["abc", "abcdfg", "asdfabc"].
filter(inStrings, searchString, true) - Returns ["abc", "abcdfg", "asdfabc"].
filter(inStrings, searchString, false) - Returns ["abc"].
filter(inStrings, searchString, true, 0) - Returns ["abc", "abcdfg", "asdfabc"]
filter(inStrings, searchString, true, 1) - Returns ["abc", "Abc", "abcdfg", "asdfabc"].
filter(inStrings, searchString, false, 1) - Returns ["abc", "Abc"].
