It is exceedingly simple in PowerShell to look for an element in an array.
The scenario for you is that you need to know if the list of names that was output from the Accessing and manipulating array items recipe contains the name, Torres, Leon.
It is exceedingly simple in PowerShell to look for an element in an array.
The scenario for you is that you need to know if the list of names that was output from the Accessing and manipulating array items recipe contains the name, Torres, Leon.
We will build on the Accessing and manipulating array items recipe. Here is the flow:
The following script would accomplish this:.
$Names = Get-Content ./ch09/02-names.txt $NewNames = @() foreach ($Name in $Names) { $Name = $Name -split ' ' ...