Remove spaces from a string – Powershell

Recently had a need to remove the spaces from a string in powershell. Here is a really simple way to do so:

That will return “TestAccountTestAccount”

1 comment… add one
  • Tim Jardim Link Reply

    That is a great little trick, Thanks for sharing. Here is another way to manipulate strings using DotNet

    $A = ‘1234567890’
    $A.Remove(5,1)

    $A = ‘1234567890’
    $A.Remove(5,1).Insert(5,”a”)

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.