Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

replacing more than one character in a variable

$
0
0

Hi,

  I would think there's a way to replace more than one character with one replace but cannot find an example anywhere.

$str1='  A_PROCESS_DATE, ACOUNTRY)'

I want to get rid of ',' ')' and multiple spaces. I'm currently doing

 

$str1=$str1-replace'\)',' '

 

$str1=$str1-replace',',' '

 

$str1=$str1-replace'\s+',' '

which works but is clunky. Any suggestion?

Thanks,

Bob


Viewing all articles
Browse latest Browse all 6937

Trending Articles