Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Filter - function of language VBScript

Description:
Returns a array (zero-based index) containing subset of a string array based on a specified filter criteria.
Syntax:
Filter(InputStrings As String, Value As String, [Include As Boolean], [Compare As Integer]) As Array
Calling:
a = Filter(InputStrings, Value[, Include[, Compare]])
Parameters:
InputStrings(String) 1-dimensional array of strings to be searched.
Value(String) String to search for
Include[optional] (Boolean) Logical value indicating whether to return substrings that include or exclude Value
true (default) - function returns the subset of the array that contains Value as a substring
false - function returns the subset of the array that does not contain Value as a substring
Compare[optional] (Integer) Numeric value indicating the kind of string comparison to use. If omitted, a binary comparison is performed.
vbBinaryCompare - perform a binary comparison
vbTextCompare (default) - perform a textual comparison
Note:
If no matches of Value are found within InputStrings, Filter returns an empty array. An error occurs if InputStrings is Null or is not a 1-dimensional array.

The array returned by the function contains only enough elements to contain the number of matched items.

Example:
Dim nIndex
Dim nArray(3)
nArray(0) = "Sunday"
nArray(1) = "Monday"
nArray(2) = "Tuesday"
nIndex = Filter(MyArray, "Mon") 'MyIndex(0) contains "Monday"
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice