Press "Enter" to skip to content

Trimming Strings with Powershell

Patrick Gruenauer shows off the Trim series of methods in Powershell:

In PowerShell it’s easy to manipulate strings, especially to cut off some characters from a string. These three methods are your friends when it comes to trimming: Trim, TrimStart and TrimEnd. In this blog post I will show you how to use PowerShell to manipulate strings and cut off something at the beginning and at the end. I will also try to give you some useful practical examples in hand to convince you that it’s worth to learn something about string manipulation. Let’s hop in.

Click through for examples of these three methods and how they do more than removing whitespace.