Features
      Ask DevGuru
      ASP Resources
      Find the Bug
      Knowledge Base
      Links
      Tips of the Week
      Tutorials
  Products
      dgCalendar
      dgCharge New!
      dgChart New!
      dgFileUpload
      dgReport New!
      dgSort
      dgTree
  Site
      Authoring
      Coming Soon
      DevGuru Resume
      Link to Us
      Merchandise
      Sponsorships
      Testimonials
      What's New
  Technologies
      ADO 2.6
      ASP
      CSS2
      HTML
      JavaScript
      Jet SQL
      Transact-SQL Syntax
      VBScript
      WML
      WMLScript
      WSH
      XML DOM

              











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-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information