SPLIT(expression [,delimiter] [,limit] [,compare])

Returns the array containing a specified number of substrings (Variant).


expressionThe expression containing substrings and delimiters (String)
delimiter(Optional) The character used to identify substring limits (String)
limit(Optional) Number of substrings to be returned
-1 = all substrings are returned.
compare(Optional) A vbCompareMethod constant specifying the type of string comparison to use (Integer):
-1 = vbUseCompareOption (uses the "Option Compare" setting)
0 = vbBinaryCompare
1 = vbTextCompare
2 = vbDatabaseCompare (uses an Access database)

REMARKS
* If "expression" = "" (zero length string), then an empty array is returned.
* If "delimiter" = "" (zero-length string), then a single-element array containing the "expression" is returned.
* If "delimiter" is left blank, then the space character (" ") is used.
* If "limit" is blank, then ??
* If "compare" is blank, then ??
* This function will always return a zero-based array irrespective of whether you declare "Option Base 1".
* The array returned is always a 1-dimensional array.
* When ever there is more than one space within the string, the corresponding array element is a zero length string.
* This function can return an empty array. When this happens the lowerbound is 0 and the upperbound is -1.
* The equivalent .NET function is Microsoft.VisualBasic.Strings.Split
* For the Microsoft documentation refer to docs.microsoft.com

Dim aValues As Variant 
Dim sStringConcat As String
sStringConcat = "one,two,three"
aValues = Split(sStringConcat, ",") = {"one","two","three"}

© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited Top