Converting VBScript's LCase Function


Windows PowerShell


Definition: Returns a string that has been converted to lowercase.

LCase

Using Windows PowerShell, can you convert all the characters in a string to their lowercase equivalent? Of course you can; all you have to do is call the ToLower() method. For example, here we assign 26 uppercase letters to the variable $a; we then use the ToLower() method to convert all the characters in the string to lowercase:



$a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
$a = $a.ToLower()

When you run this command and then echo back the value of $a you should get the following:



abcdefghijklmnopqrstuvwxyz


Return to the VBScript to Windows PowerShell home page

Show: