PowerShell: Join String

By Xah Lee. Date: . Last updated: .

💡 TIP: Operator names are case-insensitive.

Join String by Plus Operator

"a"+"b"+"c"
# "abc"

-join (operator)

-Join (str1, str2, etc)

Join strings. (Parenthesis required.)

-join ("a", "b", "c")
# "abc"
(str1, str2, etc) -Join delimiter
  • Join strings with delimiter.
  • delimiter is a string and can have multiple characters.
("a", "b", "c") -join " "
# "a b c"

Join-String (cmdlet)

There is also a Join-String cmdlet.

PowerShell, string and regular expression