Skip to content

PowerShell: Check if a value exists in an array

You can check if a value or string exists in an array using the Contains method from an array.

Below is a simple example:

$languages = "Java","PHP","GO",".net"
$languages.contains("PHP"); # Output: True
$languages.contains("php"); # Output: False
$languages.contains("node.js") # Output: False
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments