loop through two strings and combine

coder4life

Member
Joined
Sep 25, 2013
Messages
9
Programming Experience
1-3
i have 2 strings

eg

String A

2
3
4
5

and String B

6
7
8
9

i want to loop through both and get this result into an array

2,6
3,7
4,8
5,9

the purpose is to compare line by line string A to string B and record the result in a separate variable
 
Why would you want to combine them if the purpose is to compare them? If I'm not mistaken, you've already been told elsewhere that it's a bad idea to use a single String containing multiple numbers on multiple lines if your aim is to work with numbers. If you want to compare numbers then you first need numbers to compare and then you actually need to compare them, neither of which you've even asked how to do.
 
In addition to this, and even though some previous examples may have been a bit too complicated, you have already been shown how to convert Strings to Integers, how to put items into an array, how to use Skip and Take and how to use a For Loop to get an element from each of two arrays and do something with those elements.

So, knowing that, you should have everything you need to complete this the way you need.

Ian
 
Back
Top