Using String Functions

by Jun 8, 2009

PowerShell uses .NET objects everywhere. Anything is represented as .NET object, and .NET objects come with useful built-in methods. However, for string manipulation you do not need to look for sophisticated external commands as they are built right into strings.

Here are a couple of useful examples:

"Hello".Insert(3, "INSERTED")
"Hello".Replace('l', 'x')
" remove space at ends ".Trim()
" remove space at ends ".Trim(' rem')