Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

Strings.Join Method (String[], String)

Returns a string created by joining a number of substrings contained in an array.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
static member Join : 
        SourceArray:string[] * 
        Delimiter:string -> string

Parameters

SourceArray
Type: System.String[]

Required. One-dimensional array containing substrings to be joined.

Delimiter
Type: System.String

Optional. Any string, used to separate the substrings in the returned string. If omitted, the space character (" ") is used. If Delimiter is a zero-length string ("") or Nothing, all items in the list are concatenated with no delimiters.

Return Value

Type: System.String
Returns a string created by joining a number of substrings contained in an array.
ExceptionCondition
ArgumentException

SourceArray is not one dimensional.

There is a parity between the Join and Split functions. The Join function takes an array of strings and joins them using a delimiter string, to return a single string. The Split function takes a string and separates it at the delimiter, to return an array of strings. However, a key difference is that Join can concatenate strings with any delimiter string, Split can only separate strings using a single character delimiter.

The following example demonstrates how to use the Join function to create a list from several strings.

Dim TestItem() As String = {"Pickle", "Pineapple", "Papaya"}
' Returns "Pickle, Pineapple, Papaya" 
Dim TestShoppingList As String = Join(TestItem, ", ")

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft. All rights reserved.