Tuesday, January 24, 2012

Part-2: Text Manipulation in PowerShell using .ToLower and .ToUpper method

 

Part-1: http://newdelhipowershellusergroup.blogspot.com/2012/01/part-1-text-manipulation-in-powershell.html

Hi,

In part-1 of text manipulation we saw how to use .Trim(),.TrimStart() and TrimEnd() method. Today we will see how to use .ToLower and ToUpper() Method.

Lets start

we are using the same text which we used in part-1 and saving the text in a variable $text

$text = "The Quick brown fox jumps over the lazy dog"

24-01-2012 12-42-07

.ToLower()

When we use ToLower() method it convert the whole string in lowercase.

Check first what $text contains.  and it contains the text which we provide to variable $text

24-01-2012 12-44-23

When we run the $text.ToLower() it converted the whole string in to lower case.

24-01-2012 12-46-13 

Let’s compare it with original one. You can see it converted the whole string to lower case {actually “T” in “The” and “Q” in “Quick” is uppercase in original text}

24-01-2012 12-49-00

ToUpper()

The ToUpper() method convert the whole string in to uppercase.

$text.ToUpper()

You can see that the whole string in converted to UPPER CASE :)

24-01-2012 12-55-24

let compare it with our original text.

Happy????? :)

24-01-2012 12-57-17

I hope it helps someone :)

Thanks

Aman Dhally

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.