YouTip LogoYouTip

Func Filter

# VBScript Filter Function * * Complete VBScript Reference Manual](#) * * * The Filter function returns a zero-based array containing a subset of a string array based on a specified filter criteria. **Note:** If no match is found for the value parameter, the Filter function will return an empty array. **Note:** An error will occur if the inputstrings parameter is Null or not a one-dimensional array. ### Syntax Filter(inputstrings,value[,include[,compare]]) | Parameter | Description | | :--- | :--- | | inputstrings | Required. The one-dimensional string array to be searched. | | value | Required. The string to search for. | | include | Optional. Boolean value specifying whether the returned substring should include the Value. If Include is True, Filter returns the array subset containing the substring Value. If Include is False, Filter returns the array subset not containing the substring Value. Default is True. | | compare | Optional. Specifies the type of string comparison to use. Can be one of the following values: * 0 = vbBinaryCompare - Performs a binary comparison * 1 = vbTextCompare - Performs a text comparison | ## Examples ## Example 1 Filter: Items containing "S": a=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") b=Filter(a,"S") for each x in b document.write(x & "
") next The output of the above example: Sunday Saturday [Try it Β»](#) ## Example 2 Filter: Items not containing "S" (include=False): a=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") b=Filter(a,"S",False) for each x in b document.write(x & "
") next The output of the above example: Monday Tuesday Wednesday Thursday Friday [Try it Β»](#) ## Example 3 Filter: Items containing "S", using text comparison (compare=1): a=Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") b=Filter(a,"S",True,1) for each x in b document.write(x & "
") next The output of the above example: Sunday Tuesday Wednesday Thursday Saturday [Try it Β»](#) * * Complete VBScript Reference Manual](#) AI is thinking... [](#)(#) (#)[](#)
← Func IsarrayVb Func Array β†’