I have a string like this:
$string = "Test file.cs file.sql file.xml"
I want to check if the string contains a file with .sql and not contains a file with .cs and many other file extensions.
So far I have a very long script to check it:
if($string.Contains(".sql") -and (!$string.Contains(".cs") -or (!$string.Contains(".js")))) # and more....
Is there easy way to do it?
Something like:
$ext = "cs,css,js,xml"
if(!$string.Cotnains($ext))