Exabytes beginner

Wednesday, June 27, 2007

Single Dimension Array concatenation

Single dimension array

Most of the time you will find that you need to concatenate 2 or more arrays.Somehow in classic asp there's no built in function that can combine array in one command. At least not that i know. Fill with the desperation to do it most of the time i wrote a simple function to concatenate 2 or more arrays

First i create a function call concat:

Function concat(array1,array2)
str1=join(array1,",")
str2=join(array2,",")
str3=str1 & "," &
str2 concat=split(str3,",")
end function

then I call the function anywhere when you need to concatenate arrays. For example, you want concatenate single dimension array

aitem1=array("A1","A1","A3")
aitem2=array("A4","A5","A6")

using this function:
aitem3=concat(aitem1,aitem2)

The elements for aitem3 are: "A1","A1","A3","A4","A5","A6"

I AM THE AUTHOR
Noraida Arifin
16 years  programming experience and  still learning.
spent 13 years of my life span as a software engineer
in a multinational company
Currently  a retire programmer.
Feedback are welcome.
Contact me at :
https://www.facebook.com/makcikprogrammer

No comments:

Post a Comment