wlado's website

PowerShell - Ořezání textu o mezery

https://blogs.technet.microsoft.com/heyscriptingguy/2014/07/18/trim-your-strings-with-powershell/

Priklad -- Trim specific characters

If there are specific characters I need to remove from both ends of a string, I can use the Trim(char[]) method. This permits me to specify an array of characters to remove from both ends of the string. Here is an example in which I have a string that begins with “a “ and ends with “ a”. I use an array consisting of “a”, “ “ and it removes both ends of the string. Here is the command:

$string = "a String a"

$string1 = $string.Trim("a"," ")