PowerTip: Adjusting the Case of a String

PowerTip: Adjusting the Case of a String

  • Comments 2
  • Likes

Summary: Use Windows PowerShell to adjust the case of an entire string.

Hey, Scripting Guy! Question How can I adjust the case of an entire string?

Hey, Scripting Guy! Answer Charlotte PowerShell User Group member Brian Wilhite says: One way to adjust the case (upper or lower) of an entire string object is to call the ToUpper or ToLower methods of the string object.

(‘this string should be upper case’).ToUpper()

(‘THIS STRING SHOULD BE LOWER CASE’).ToLower()

 

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • <p>For proper case, this works:</p> <p>(get-culture).textinfo.totitlecase(&#39;george washington&#39;)</p>

  • <p>@Thorn</p> <p>Nice tip!</p>