The Split function separates a string into substrings and
creates a one-dimensional array where each substring is an element.
Comparison Constants
CONSTANT | VALUE | DESCRIPTION |
---|---|---|
VBBinaryCompare | 0 | Binary comparison |
VBTextCompare | 1 | Text Comparison |
VBDataBaseCompare | 2 | Compare information inside database |
<% mystring = "How now brown cow?" %>
<% myarray = Split(mystring) %>
<% =myarray(0) %>
<% =myarray(1) %>
<% =myarray(2) %>
<% =myarray(3) %>
How
now
brown
cow?
<% mystring = "How now brown cow?" %>
<% myarray = Split(mystring, "ow") %>
<% =myarray(0) %>
<% =myarray(1) %>
<% =myarray(2) %>
<% =myarray(3) %>
<% =myarray(4) %>
H
n
br
n c
?
<% mystring = "How now brown cow?" %>
<% myarray = Split(mystring, " ", 2) %>
<% =myarray(0) %>
<% =myarray(1) %>
How
now brown cow?
<% mystring = "How now brown cow?" %>
<% myarray = Split(mystring, "B", 2, 1) %>
<% =myarray(0) %>
<% =myarray(1) %>
How now
rown cow?
<% mystring = "How now brown cow?" %>
<% myarray = Split(mystring, "B", 2, VBTextCompare) %>
<% =myarray(0) %>
<% =myarray(1) %>
How now
rown cow?
In the example, by using VBTextCompare for the Compare argument, the split occurs at the b and ignores the upper case difference between the Delimiter argument "B".