Strings.Join Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a string created by joining a number of substrings contained in an array.
Overloads
Join(Object[], String) |
Returns a string created by joining a number of substrings contained in an array. |
Join(String[], String) |
Returns a string created by joining a number of substrings contained in an array. |
Join(Object[], String)
- Source:
- Strings.vb
- Source:
- Strings.vb
- Source:
- Strings.vb
Returns a string created by joining a number of substrings contained in an array.
public static string? Join (object?[] SourceArray, string? Delimiter = " ");
public static string Join (object[] SourceArray, string Delimiter = " ");
static member Join : obj[] * string -> string
Public Function Join (SourceArray As Object(), Optional Delimiter As String = " ") As String
Parameters
- SourceArray
- Object[]
Required. One-dimensional array containing substrings to be joined.
- Delimiter
- 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.
Returns
A string created by joining a number of substrings contained in an array.
Exceptions
SourceArray
is not one dimensional.
Examples
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, ", ")
Remarks
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.
See also
Applies to
Join(String[], String)
- Source:
- Strings.vb
- Source:
- Strings.vb
- Source:
- Strings.vb
Returns a string created by joining a number of substrings contained in an array.
public static string? Join (string?[] SourceArray, string? Delimiter = " ");
public static string Join (string[] SourceArray, string Delimiter = " ");
static member Join : string[] * string -> string
Public Function Join (SourceArray As String(), Optional Delimiter As String = " ") As String
Parameters
- SourceArray
- String[]
Required. One-dimensional array containing substrings to be joined.
- Delimiter
- 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.
Returns
A string created by joining a number of substrings contained in an array.
Exceptions
SourceArray
is not one dimensional.
Examples
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, ", ")
Remarks
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.
See also
Applies to
Σχόλια
https://aka.ms/ContentUserFeedback.
Σύντομα διαθέσιμα: Καθ' όλη τη διάρκεια του 2024 θα καταργήσουμε σταδιακά τα ζητήματα GitHub ως μηχανισμό ανάδρασης για το περιεχόμενο και θα το αντικαταστήσουμε με ένα νέο σύστημα ανάδρασης. Για περισσότερες πληροφορίες, ανατρέξτε στο θέμα:Υποβολή και προβολή σχολίων για