The string element in array

I have the array and the string:
$Array = “1”, “2”, “3”
$String1 = “456”
$String2 = “451”

And I need to check, is string contain one of array elements. Like:
Is String1 contains Array? -False
Is String2 contains Array? -True
How can I do that?

When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

How to format code in PowerShell.org 1 <---- Click :point_up_2:t4: :wink:

( !! Sometimes the preformatted text button hides behind the settings gear symbol. :wink: )

You could use Select-String with the string as -InputObject and $Array as the -Pattern.