Answers for "powershell string contains"

1

powershell if string contains

$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'
}
Posted by: Guest on January-21-2022
0

powershell string contains

PS C:\> "abc", "def" -Contains "def"
True

PS C:\> "Windows", "PowerShell" -Contains "Shell"
False  #Not an exact match
Posted by: Guest on March-24-2022

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language