Join function to add all elements of an array to create string variable in ASP

We can create a string by joining all the elements of an array by using join() function. The out put of this function is a string variable. Here is the syntax of using join() function.

My_String = join(My_Array)
Here My_Array is the array and the My_String is the string variable which gets the string which is returned by join function after adding all the elements of the My_Array array.

While joining by default one blank space is used as delimiter, we can specify any delimiter while joining the elements by using join function. Here is the syntax of this.

my_String=join(myArray,",")
This way we can have any delimiter added between the elements while generating the string variable. In the above example comma ( , ) is used.

Here is the complete code for joining elements and creating a string variable.


Dim myArray(3) 'Declaring a dynamic array

myArray(0) = "UK"
myArray(1)="USA"
myArray(2)="Canada"
myArray(3)="UAE"

For Each item In myArray
   Response.Write(item & "<br>")
Next

my_String=join(myArray,",")
   Response.Write(my_String & "<br>")
Same way we can create array by breaking string using split function

Be the first to post comment on this article :





Post your comments , suggestion , error , requirements etc here .




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