Hi,
I have been spending several weeks figuring this out but couldn`t find way to it. Here is what I am planning to do, I have a text file with several data in it, and I have to extract part of the data into a 2 dimensional array.
Here is a sample of the text file where each line represent data in each row in text file:
A
B
C
D
A>3;C>2
D>5;B<3
I want to make a 2 dimensional string array and put it in this form
A B C D
>3 <3 >2 >5 <-- so this sample is a 2x4 array
Here is how I got it: First read through the first 4 row then put each of them in a column. Then read through other 2 row, check which character matches whichof the first 4 rows and put the comparison sign and number under it in the 2 dimensional array. So for example when I get to line"A>3;B>2" I check which column A is in and put >3 under it, when encounter a ";" move to check next one on the line, so check which column C is in and put >2 under it in the new two dimensional array... and so on. I don`t know how to write a java code to extract like what I wanted.
What I have done so far is I was able to get each row into a 1 dimensional string array each from reading the textfile in,
so now I got a string array to have such content:
text[0]=A
text[1]=B
.
.
text[5]=C>5;D<3
But I want to turn those text[] string array into the 2 dimensional string array form that I want. How do I extract content of each string array? How should I start?