Version: 1.0
The Filter function searches the elements of a zero-based
array, to match a pattern of one or more characters, and creates a new
array, either with or without the elements containing the matched
pattern.
You can create a zero-based string array by using the Split
function. The Join function is used to reassemble the string
after applying the Filter function.
Comparison Constants
CONSTANT | VALUE | DESCRIPTION |
---|---|---|
VBBinaryCompare | 0 | Binary comparison |
VBTextCompare | 1 | Text Comparison |
VBDataBaseCompare | 2 | Compare information inside database |
<% myarray = Split("How now purple cow?") %>
<% myfilterarray = Filter(myarray, "ow") %>
<% =Join(myfilterarray) %>
How now cow?
<% myarray = Split("How now purple cow?")
%>
<% myfilterarray = Filter(myarray, "ow", True) %>
<% =Join(myfilterarray) %>
How now cow?
<% myarray = Split("How now purple cow?")
%>
<% myfilterarray = Filter(myarray, "ow", False) %>
<% =Join(myfilterarray) %>
purple
<% myarray = Split("How now purple cow?")
%>
<% myfilterarray = Filter(myarray, "OW", True, 0) %>
<% =Join(myfilterarray) %>
(No output, because no match)
In the example, by using VBBinaryCompare, or 0, for the Compare argument, all upper/lower case differences are obeyed in the search.
<% myarray = Split("How now purple cow?")
%>
<% myfilterarray = Filter(myarray, "OW", True, VBTextCompare)
%>
<% =Join(myfilterarray) %>
How now cow?
In the example, by using VBTextCompare, or 1, for the Compare argument, all upper/lower case differences are ignored in the search.