Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Functions
Join Function
FUNCTION: Split( )
Split
(Expression,
Delimiter, Count, Compare
)
The
Split
function separates a string into substrings and creates a one-dimensional array where each substring is an element.
There is one mandatory argument.
Expression
The
Expression
argument is a string expression.
Code:
<% mystring = "How now brown cow?" %>
<% myarray = Split(mystring) %>
<% =myarray(0) %>
<% =myarray(1) %>
<% =myarray(2) %>
<% =myarray(3) %>
Output:
How
now
brown
cow?
There are three optional arguments.
Delimiter
The optional
Delimiter
argument specifies the characters (including blanks) you wish to use to separate the expression. The default is a single empty space, " ".
Code:
<% mystring = "How now brown cow?" %>
<% myarray = Split(mystring, "ow") %>
<% =myarray(0) %>
<% =myarray(1) %>
<% =myarray(2) %>
<% =myarray(3) %>
<% =myarray(4) %>
Output:
H
n
br
n c
?
Count
The optional
Count
argument specifies the number of elements to return.
Code:
<% mystring = "How now brown cow?" %>
<% myarray = Split(mystring, " ", 2) %>
<% =myarray(0) %>
<% =myarray(1) %>
Output:
How
now brown cow?
Compare
The optional
Compare
argument must only use the constant or value of the COMPARISON CONSTANTS.
CONSTANT
VALUE
DESCRIPTION
VBBinaryCompare
0
Binary comparison
VBTextCompare
1
Text Comparison
VBDataBaseCompare
2
Compare information inside database
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".
Code:
<% mystring = "How now brown cow?" %>
<% myarray = Split(mystring, "B", 2, 1) %>
<% =myarray(0) %>
<% =myarray(1) %>
Output:
How now
rown cow?
Code:
<% mystring = "How now brown cow?" %>
<% myarray = Split(mystring, "B", 2, VBTextCompare) %>
<% =myarray(0) %>
<% =myarray(1) %>
Output:
How now
rown cow?
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information