Author Posts

January 1, 2012 at 12:00 am

by leitsu at 2013-04-01 16:56:35

Hi
How do I modify a variable. Thats say I have a variable $var = "ABC EFG". How do I check if there is a space in the variable and replace the space with "-"? $var = "ABC-EFG"

by Nobody at 2013-04-01 19:30:32

Use the "Replace" method


$a = "ABC EFG"
$a = $a.replace(" ","-")

Lots of other string methods available too! Pipe the string to Get-Member and have a look


"my string"|Get-Member