Split() breaks a string into a zero-based, one-dimensional array. You can choose the delimiter, limit the number of returned substrings, and control comparison behavior.
myArray = Split(myString, " ")
If the delimiter is omitted, a space is used. A zero-length input string returns an empty array.
myString = "Welcome to plus2net, learn web programming and design"
myArray = Split(myString, " ", 3)
The third element receives the rest of the string:
myArray(0) = Welcome
myArray(1) = to
myArray(2) = plus2net, learn web programming and design
Dim myString, myArray, item
myString = "Welcome to plus2net, learn web programming and design"
myArray = Split(myString, " " )
For Each item In myArray
Response.Write "<br>" & item
Next
The old square-bracket notation such as myArray[0] is not VBScript array syntax; VBScript uses parentheses such as myArray(0). Use Join() to combine the array again.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.
| bobby | 23-04-2016 |
| Well, after split, then how to store that result to database? I mean in MS Access.. | ID | Name | |----|----------| | 1 | Welcome | | 2 | to | | 3 | plus2net, learn web programming and design| cause everytime i tried, it becomes comma separated values in one row | |