Convert a String to an Array with Split()

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.

Syntax

myArray = Split(myString, " ")

If the delimiter is omitted, a space is used. A zero-length input string returns an empty array.

Limit the returned elements

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

Complete example

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.


ASP Home



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



✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer