Filter

Produce an array by filtering an existing array.

Syntax 
      Filter (SourceArray, FilterString [,Switch [,Compare]])

Key
   SourceArray  An array to be filtered

   FilterString A string of characters to find in SourceArray

   Switch       If True include items that match FilterString
                If False include items that don’t match FilterString

   Compare      vbBinaryCompare (0), vbTextCompare (1)

Examples

arrDemo=Filter(vaVolcanoes, "Cinder cone")
WScript.Echo arrDemo(0)

PowerShell equivalent, using the where-object cmdlet:

$array = "magnificent", "marvelous", "mesmeric", "mesmerizing"
$array = ($array | where-object {$_ -like "Mes*"})

“To be without some of the things you want is an indispensable part of happiness” ~ Bertrand Russell

Related VBScript commands

Array - Add values to an Array variable.
Equivalent in PowerShell: Hash Tables


 
Copyright © 1999-2025 windevcluster.com
Some rights reserved