Summary: Learn four ways to use Windows PowerShell to find letters in strings.
I want to find out if a string contains the letter “m.” The string is stored in the variable $a as shown here:
$a=”northern hairy-nosed wombat”
Here are a variety of ways to accomplish this:
a. [string]$a.contains(“m”)
b. $a.contains(“m”)
c. [regex]::match($a,"m")
d. ([regex]::match($a,"m")).success