Share This Post

PowerShell

PowerShell Tip: Replacing Characters in a String

PowerShell Tip: Replacing Characters in a String

You might need to replace certain characters in strings. Use the Replace string method.

For example, the following locates all underscores and replaces them with dashes:

$str = $str.replace(‘_’,’-‘) 

 


Looking for an awesome, no-nonsense technical conference for IT Pros, Developers, and DevOps? IT/Dev Connections kicks off in Dallas, Texas in 2018!

IT/Dev Connections

Share This Post

Leave a Reply