about_join - PowerShell


 

Describes how the join operator (-join) combines multiple strings into a (about_join)

   
# TOPIC
about_join

# SHORT DESCRIPTION
Describes how the join operator (-join) combines multiple strings into a
single string.

# LONG DESCRIPTION
The join operator concatenates a set of strings into a single string. The
strings are appended to the resulting string in the order that they appear
in the command.

Syntax
The following diagram shows the syntax for the join operator.

-Join <String[]>
<String[]> -Join <Delimiter>

Parameters
String[]
Specifies one or more strings to be joined.

Delimiter
Specifies one or more characters placed between the concatenated strings.
The default is no delimiter ("").

Remarks
The unary join operator (-join <string[]>) has higher precedence than
a comma. As a result, if you submit a comma-separated list of strings to
the unary join operator, only the first string (before the first comma)
is submitted to the join operator.

To use the unary join operator, enclose the strings in parentheses, or
store the strings in a variable, and then submit the variable to join.

For example:

-join "a", "b", "c"
a
b
c

-join ("a", "b", "c")
abc

$z = "a", "b", "c"
-join $z
abc

Examples
The following statement joins three strings:

-join ("Windows", "PowerShell", "2.0")
WindowsPowerShell2.0

The following statement joins three strings delimited by a space:

"Windows", "PowerShell", "2.0" -join " "
Windows PowerShell 2.0

The following statements use a multiple-character delimiter to join
three strings:

$a = "WIND", "SP", "ERSHELL"
$a -join "OW"
WINDOWSPOWERSHELL

The following statement joins the lines in a here-string into
a single string. Because a here-string is one string, the lines in the
here-string must be split before they can be joined. You can use this
method to rejoin the strings in an XML file that has been saved in a
here-string:

$a = @'
a
b
c
'@

(-split $a) -join " "
a b c

SEE ALSO
about_Operators
about_Comparison_Operators
about_Split

C:\Windows>powershell get-help about_Language_Keywords -full

ColorConsole [Version 1.7.1000] PowerShell 2.0-Export
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2014 Microsoft Corporation.

OS: Windows 10, 8.1, 8, 7, Vista / Windows Server 2016, 2012, 2008
»»»» ColorConsole








Windows-10





Windows-10

... facebook.de
... Windows-10 FAQ
... Windows-10 Info


Become a Sponsor
... Your button here?





PowerShell: Describes how the join operator (-join) combines multiple strings into a

HTTP: ... PS_Windows/en/about_join.htm
0.249
13220

Unterschied CPU, FPU, GPU ?

 /

Can I show Control Panel, My Computer, Network on Windows 8, 8.1 Desktop and Win 10?

 /

Der Unterschied zwischen Dateien und Ordnern?

 /

Where are the Auto Update settings in Windows 10 (enable / turn off)?

 /

Recht schnell durch STRG ein Ping Befehl ausführen!

 /

Can I turn off or enable hibernate in windows 7?

 /

The Windows 8.1 Desktop Search!

 /

What is USB (interface)?

 /

Wenn die Maus Geschwindigkeit sich immer wieder ändert!

 /

Smart screen and upgrade problem with Win-10!

 /

Simple Digital Desktop Clock Sample on Windows 10, 8.1, 7!

 /

Shortcut for Device Manager on Windows-10 Desktop, how to? (Drivers)

 /