What is the filter function in Arrays (Vb Script)?
Tags:
Question ID: 105808
0
0
Marked as spam
Posted by (Questions: 17, Answers: 7)
Asked on January 16, 2015 8:47 am
21 views
Answers (1)
1
Private answer

Taken from www.w3schools.com:

The Filter function returns a zero-based array that contains a subset of a string array based on a filter criteria.

Note: If no matches of the value parameter are found, the Filter function will return an empty array.

Note: If the parameter inputstrings is Null or is NOT a one-dimensional array, an error will occur.
Syntax
Filter(inputstrings,value[,include[,compare]])

'Filter items that contain ''S''

a=Array(''Sunday'',''Monday'',''Tuesday'',''Wednesday'',''Thursday'',''Friday'',''Saturday'')
b=Filter(a,''S'')
for each x in b
response.write(x & ''
'')
next

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Output values are:

Sunday
Saturday

'Filter items that do not contain an ''S'' (include:=False)

a=Array(''Sunday'',''Monday'',''Tuesday'',''Wednesday'',''Thursday'',''Friday'',''Saturday'')
b=Filter(a,''S'',False)
for each x in b
response.write(x & ''
'')
next

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Output values are:

Monday
Tuesday
Wednesday
Thursday
Friday

Marked as spam
Posted by (Questions: 2, Answers: 477)
Answered on April 1, 2015 3:39 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top