Filter
The Filter function will eliminate elements of an array
that match or fail to match a search string. This allows you
to remove forbidden words from text or only allow certain words
to be entered.
Dim aArray Dim sText
sText ="Remove those dirty words" aArray = Split(sText) aArray = Filter(aArray, "dirty") sText = Join(aArray) Response.Write "Filtered Text: " & sText
The third optional argument is a boolean value that indicates
whether the search text should include words in the array or
exclude words in the array. True indicates that only words that
contain the search text should be returned. False means that only
words that DO NOT contain the search text should be returned.
If not specified, this argument defaults to True.
Dim aArray Dim sText
sText ="Remove those dirty words" aArray = Split(sText) aArray = Filter(aArray, "dirty", False) sText = Join(aArray) Response.Write "Filtered Text: " & sText
An optional fourth argument specifies what type of string comparison
should be done in order to filter out words. The default is to do a
text comparison. Possible values for this argument are shown below.
| ASP Variable |
Value |
Meaning |
| vbBinaryCompare |
Comparison is done on the binary values (ASCII codes) for the strings.
This is also known as a case-sensitive comparison. |
| vbTextCompare |
Comparison is done on the text values for the strings. This
is also known as a case-insensitive comparison. |
|
 |

|