Filter函数,该函数返回从零开始的数组,该数组包含基于特定过滤条件的字符串数组的子集。
Filter(inputstrings,value[,include[,compare]])
<!DOCTYPE html> <html> <body> <script language = "vbscript" type = "text/vbscript"> a = array("Red","Blue","Yellow") b = Filter(a,"B") c = Filter(a,"e") d = Filter(a,"Y") For each x in b Document.write("The Filter result 1: " & x & "<br />") Next For each y in c Document.write("The Filter result 2: " & y & "<br />") Next For each z in d Document.write("The Filter result 3: " & z & "<br />") Next </script> </body> </html>
结果:
The Filter result 1: Blue The Filter result 2: Red The Filter result 2: Blue The Filter result 2: Yellow The Filter result 3: Yellow