Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Powershell convert string to upper or lower case

Here is a nice a nice function in Powershell to Convert a String to Uppercase or Lowercase. If your looking to output important information in uppercase or convert a returned variable into lowercase we can use the built in ToUpper() or ToLower() methods.

To convert a string to Uppercase we will use the ToUpper() method.

"Hello World".ToUpper()

To convert a string to Lowercase we will use the ToLower() method.

hello world

As you can see these methods are very easy to use. We can manipulate these a lot more as they are fully featured .NET objects they support many functions.

For example we can capitalize the first letter.

$string = "hello world"
$newstring = $string.Substring(0,1).ToUpper() +

Hello world

There isn’t much else to cover on the ToUpper() and ToLower() methods. They are both very useful methods and can be incorporated into many of your powershell scripts.

The post Powershell Convert String to upper or lower case appeared first on

This post first appeared on Suspended Domain, please read the originial post: here

Share the post

Powershell convert string to upper or lower case


Subscribe to Suspended Domain

Get updates delivered right to your inbox!

Thank you for your subscription