Problem
You want to determine whether an array or list contains a specific item.
Solution
To determine whether a list contains a specific item, use the –contains operator:
PS >"Hello","World" contains "Hello" True PS >"Hello","World" contains "There" False
Discussion
The –contains operator is a useful way to quickly determine whether a list contains a specific element. To search a list for items that instead match a pattern, use the –match or –like operators.