Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Determine Letter a String Begins With

$
0
0

Summary: Use Windows PowerShell to determine the letter that a string begins with.

Hey, Scripting Guy! Question How can I use Windows PowerShell to find if a particular string begins with the letter “s”?

Hey, Scripting Guy! Answer Use the StartsWith method from the string, for example:

PS C:\> "string".StartsWith("S")

False

PS C:\> "string".StartsWith("s")

True

Note The StartsWith method is case sensitive. Therefore “S” does not match the example, but “s” does.


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>