PowerShell Tips: LDAP String Manipulation and why not to use Trim
I've been working with PowerShell a lot recently and stumbled a little bit with String Manipulation. So, I've decided to post some details of what I've learned, to hopefully help others avoid my mistakes. String manipulation can be very important when scripting, especially if the purpose of the script is to output a human readable report. First, there's a great TechNet article on string manipulation in PowerShell . It covers the basics in great detail; my intent is to supplement that article with some of the pain points that I came across while using those techniques. How to Trim a String Trimming a string simply means removing characters from the ends of that string. There are 3 Trim commands: .Trim() .TrimStart() and .TrimEnd(). As the names imply, TrimStart() removes characters from the start of a string, TrimEnd() removes characters from the end of a string, and Trim() removes characters from both ends of the string. Those Trim commands are just method