$strVal ='Hello world'
if($strVal -like '*World*') {
Write-Host 'Your string contains the word world'
} else {
Write-Host 'Your string does not contains the word world'
}
$strVal ='Hello world'
if($strVal -like '*World*') {
Write-Host 'Your string contains the word world'
} else {
Write-Host 'Your string does not contains the word world'
}
PS C:> "abc", "def" -Contains "def"
True
PS C:> "Windows", "PowerShell" -Contains "Shell"
False #Not an exact match