473,320 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Merging arrays

Hi

Is there a way to merge two or more single dimension string arrays into a
single, single dimension string array?

Thanks

Regards
May 7 '07 #1
5 10853

"John" <Jo**@nospam.infovis.co.ukwrote in message
news:eN**************@TK2MSFTNGP04.phx.gbl...
Hi

Is there a way to merge two or more single dimension string arrays into a
single, single dimension string array?

Thanks

Regards

There is no "merge" functionality but you could just append the arrays and
the sort the array in the "merged" order.

Hope this helps.

Lloyd Sheen

May 7 '07 #2
Or in addition to lloyd merge as it is forever done by looping through the
two ore more files.

Be aware to make it first arraylist in both situations otherwise it will
probably freeze up your computer.

Cor

"John" <Jo**@nospam.infovis.co.ukschreef in bericht
news:eN**************@TK2MSFTNGP04.phx.gbl...
Hi

Is there a way to merge two or more single dimension string arrays into a
single, single dimension string array?

Thanks

Regards


May 7 '07 #3
John wrote:
Hi

Is there a way to merge two or more single dimension string arrays into a
single, single dimension string array?

Thanks

Regards
Create a new array with the combined size of the arrays, and copy the
elements from the arrays:

Dim newArray As String() = New String(oldArray1.Length + oldArray2.Length)
oldArray1.CopyTo(newArray, 0)
oldArray2.CopyTo(newArray, oldArray1.Length)

--
Göran Andersson
_____
http://www.guffa.com
May 7 '07 #4
>Create a new array with the combined size of the arrays, and copy the
>elements from the arrays:

Dim newArray As String() = New String(oldArray1.Length + oldArray2.Length)
I'm sure you meant

.... New String(oldArray1.Length + oldArray2.Length - 1) {}
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
May 7 '07 #5
Mattias Sjögren wrote:
>Create a new array with the combined size of the arrays, and copy the
elements from the arrays:

Dim newArray As String() = New String(oldArray1.Length + oldArray2.Length)

I'm sure you meant

... New String(oldArray1.Length + oldArray2.Length - 1) {}
Mattias
Yes. I don't program any VB myself nowadays. I thought that when
creating an array this way, it would use the size.

--
Göran Andersson
_____
http://www.guffa.com
May 8 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Tmenke | last post by:
Can someone help, I have two arrays and want to merge them into a third array.What I want to do is, after I create this third array (combination of the first two) is to erase the original two...
4
by: Bush will disarm all workers next | last post by:
I'm new to JavaScript. So please excuse my mistakes. I need help on merging two arrays into a third one. There is an array a = {188, 180, 159, 67 } There is another array b={'Rio de Janeiro', 'Sao...
3
by: Patrick | last post by:
I have got 2 XML documents, both of which conform to the same XSD Schema, which define possible optional elements. The 2 XML documents contain 2 disjoint set of XML elements. What is the best,...
3
by: André Hänsel | last post by:
Hi! Is there a better way to do this? $command = '$array = array_merge($array,$array);'; eval($command); Regards, André
8
by: vidishasharma | last post by:
Can somebody suggest good URL which contains code for merging of 2 or more priority queues in c#.
11
by: holla | last post by:
Write the following functions that can be called by a C program: Write a function to populate an array with random integers between 0 and 99. Use the following functions of which the prototypes...
5
by: Sarge | last post by:
Good Afternoon All, I am working with Visual Studio.Net 2003 If I have Two 1D Arrays: Dim intX() As Integer = {1, 3, 5, 7, 9, 11, 13, 15, 17} Dim intY() As Integer = {2, 4, 6, 8, 9, 10, 12,...
1
by: chiefychf | last post by:
I'm working on a school project and I am having a few issues... The program calls for three arrays a,b,c that have to be sorted, then compared to even or odd and stored in arrays d & e, then merge...
1
by: kliopatraisis | last post by:
I think I've been working on this assignment for too long and my brain has stopped making connections! Basically, we are making a very simple version of AutoCAD, called HomeCAD. The problem I am...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.