 
- VBScript - Home
- VBScript - Overview
- VBScript - Syntax
- VBScript - Enabling
- VBScript - Placement
- VBScript - Variables
- VBScript - Constants
- VBScript - Operators
- VBScript - Decisions
- VBScript - Loops
- VBScript - Events
- VBScript - Cookies
- VBScript - Numbers
- VBScript - Strings
- VBScript - Arrays
- VBScript - Date
- VBScript - Procedures
- VBScript - Dialog Boxes
- VBScript - Object Oriented
- VBScript - Reg Expressions
- VBScript - Error Handling
- VBScript - Misc Statements
- VBScript Useful Resources
- VBScript - Questions and Answers
- VBScript - Quick Guide
- VBScript - Useful Resources
- VBScript - Discussion
VBScript Split Function
A Split Function returns an array that contains a specific number of values split based on a Delimiter.
Syntax
Split(expression[,delimiter[,count[,compare]]])
- expression, a Required parameter. The String Expression that can contain strings with delimiters. 
- delimiter, an Optional Parameter. The Parameter, which is used to convert into arrays based on a delimiter. 
- count, an Optional Parameter. The number of substrings to be returned, and if specified as -1, then all the substrings are returned. 
- 
compare, an Optional Parameter. This parameter specifies which comparison method to be used. - 0 = vbBinaryCompare - Performs a binary comparison 
- 1 = vbTextCompare - Performs a textual comparison 
 
Example
<!DOCTYPE html>
<html>
   <body>
      <script language = "vbscript" type = "text/vbscript">
         ' Splitting based on delimiter comma '$'
         a = Split("Red $ Blue $ Yellow","$")
         b = ubound(a)
         
         For i = 0 to b
            document.write("The value of array in " & i & " is :"  & a(i)& "<br />")
         Next
      </script>
   </body>
</html>
When the above code is saved as .HTML and executed in Internet Explorer, it produces the following result−
The value of array in 0 is :Red The value of array in 1 is : Blue The value of array in 2 is : Yellow
vbscript_arrays.htm
   Advertisements