Last active
June 11, 2018 13:25
-
-
Save AspenForester/f47dce9af69ab88462de88af81a9285d to your computer and use it in GitHub Desktop.
Compare one thing to a collection of wildcarded things
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Compare-Things | |
{ | |
[CmdletBinding()] | |
[OutputType([bool])] | |
Param | |
( | |
# The singular thing that want to see if it matches | |
[Parameter(Mandatory=$true, | |
ValueFromPipelineByPropertyName=$true, | |
Position=0)] | |
[String] | |
$ThingA, | |
# Any of these things | |
[String[]] | |
$Things | |
) | |
Process | |
{ | |
foreach ($thing in $Things) | |
{ | |
if ($ThingA -like $thing) | |
{ | |
return $true | |
} | |
} | |
return $false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment