Removing more than one white space in powershell

后端 未结 3 1077
执念已碎
执念已碎 2021-01-01 14:53

I was trying to find a way in powershell to remove more than one white space.

But what i found is how to do it in php. \"Removing more than one white-space\"

3条回答
  •  情歌与酒
    2021-01-01 14:57

    '[     Hello,     World!     ]' -replace '^\[\s+','[' -replace '\s+]$',']' -replace '\s+',' '
    

    Bacon has the explanation powershell is funny. I had to escape '[' with '\' even though I know powershells escape character is `.

提交回复
热议问题