VBS tutorial: function join function

Time:2021-10-18

Join function

Returns a string created by a join of many substrings contained in an array.

Join(list[delimiter])

parameter

list

Required. A one-dimensional array containing substrings to join.

Delimiter

Optional. The character used to separate substrings in the return string. If omitted, the null character (“”) will be used. IfdelimiterIf it is a zero length string, all items are listed in the same list without delimiters.

explain

The following example usesJoinFunction union substring of myArray:

Copy codeThe code is as follows:
Dim MyString
Dim MyArray(3)
MyArray(0) = “Mr.”
MyArray(1) = “John “
MyArray(2) = “Doe “
MyArray(3) = “III”
Mystring = join (myArray) ‘mystring contains “Mr. John Doe III”.