473,625 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10933

"John" <Jo**@nospam.in fovis.co.ukwrot e in message
news:eN******** ******@TK2MSFTN GP04.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.in fovis.co.ukschr eef in bericht
news:eN******** ******@TK2MSFTN GP04.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(oldArray 1.Length + oldArray2.Lengt h)
oldArray1.CopyT o(newArray, 0)
oldArray2.CopyT o(newArray, oldArray1.Lengt h)

--
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(oldArray 1.Length + oldArray2.Lengt h)
I'm sure you meant

.... New String(oldArray 1.Length + oldArray2.Lengt h - 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(oldArray 1.Length + oldArray2.Lengt h)

I'm sure you meant

... New String(oldArray 1.Length + oldArray2.Lengt h - 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
6022
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 arrays from memory.Is there a command in VB5 that will do this ? Thanks, Tom M
4
6799
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 Paulo', 'Brasilia', 'Belo Horizonte'} How can I merge them to produce an array that is equivalent to this: bg.xValues = ; bg.xValues = ; bg.xValues = ; bg.xValues = ;
3
1881
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, easiest, most efficient way of merging the 2 XML Documents? Can I use DataSet.Merge() facility in ADO.NET?? Any pre-requisites? Any other suggestions?
3
1775
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
3681
by: vidishasharma | last post by:
Can somebody suggest good URL which contains code for merging of 2 or more priority queues in c#.
11
4167
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 are to be found in stdlib.h • randomize() – use once to initialize the randomization process • rand() – generates a random number between 0 and the maximum value for an integer. You can scale the values down by means of the modulus. Write a...
5
1841
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, 14, 16} Dim intZ(17) As Long and need to merge array intX with array intY to form a new array intZ, is this possible?????
1
3104
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 a,b,c into another array f.. I can do two arrays, but I have issues when trying to do all three and when I do the even/odd compare I only get 2 numbers processed. here is some of the code... //*******************Function...
1
1651
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 having is this: Each House object contains an ArrayList of Storeys. Each Storey within the ArrayList contains a HashMap of Rooms. We are required to have a method that will return an array of all the Rooms within the house. Converting the HashMap to...
0
8251
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8688
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7178
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4085
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2614
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1800
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.