Table of contents

筛选器函数Filter Function

office 365 dev account|上次更新日期: 2018/3/13
2 参与人员

说明返回一个从零开始的数组,该数组包含基于指定的筛选条件的 string 数组的子集。语法筛选器 ( sourcearray、 匹配[ ,包括[ ,比较]] )筛选器函数语法具有下面这些命名参数Description Returns a zero-based array containing subset of a string array based on a specified filter criteria. SyntaxFilter( sourcearray, match [ , include [ , compare ]] ) The Filter function syntax has thesenamed argument:

sourcearraysourcearray必需。要搜索的字符串的一维度组。Required. One-dimensional array of strings to be searched.
匹配项match必需。要搜索的字符串。Required. String to search for.
包括include可选。 布尔值,该值指示是否返回包含或排除匹配的子字符串。如果包含,则返回 True筛选将返回包含作为子字符串匹配的数组的子集。如果包括False时,筛选将返回不包含作为子字符串匹配数组的子集。Optional. Boolean value indicating whether to return substrings that include or exclude match. If include is True, Filter returns the subset of the array that contains match as a substring. If include is False, Filter returns the subset of the array that does not contain match as a substring.
比较compare可选。指示要使用的字符串比较类型的数值。请参阅“设置”部分了解相关值。Optional. Numeric value indicating the kind of string comparison to use. See Settings section for values.

设置比较参数可以具有下列值:Settings The compare argument can have the following values:

vbUseCompareOptionvbUseCompareOption-1-1通过使用该选项比较语句设置比较。Performs a comparison using the setting of the Option Compare statement.
vbBinaryComparevbBinaryCompare00执行二进制比较。Performs a binary comparison.
vbTextComparevbTextCompare11执行文本比较。Performs a textual comparison.
vbDatabaseComparevbDatabaseCompare22仅适用于 Microsoft Access。根据数据库中的信息执行比较。Microsoft Access only. Performs a comparison based on information in your database.

备注如果在sourcearray中找到了匹配的匹配项,则筛选器将返回一个空数组。如果sourcearray或不是一个一维数组,就会出错。由Filter函数返回的数组包含的元素数目足以容纳匹配项数目。Remarks If no matches of match are found within sourcearray, Filter returns an empty array. An error occurs if sourcearray is Null or is not a one-dimensional array. The array returned by the Filter function contains only enough elements to contain the number of matched items.

© 2018 Microsoft