Asp array from comma delimited list

This is a handy snipped to create an array from a list of items separated by a comma, like you would get submitted from a checkbox group. Its as easy as using the “Split” function as so:

MyString = "ItemOne, ItemTwo, ItemThree"
MyArray= Split(MyString , ",")

 

You could then access the elements using the standard array language MyArray(x)

For x = LBound(MyArray) to UBound(MyArray)
    Response.Write MyArray(x)
Next

Leave a Reply