I have a text file in this format:

AUGC
U1212
A2121
G3434
C4343

I need to extract the number that I need depending on which variables (letters) I'm comparing. For example, I need the value for A and U, so the value I need to look up for or extract is 1. For C and C, I will need to extract 3, and so on and so forth. I need a program that can look up this table automatically and extract what I need. May I know how do I do that?

Recommended Answers

All 2 Replies

Sorry, the first row, AUGC should be directly above the numbers 1212. There is some posting error. So the top right hand corner is actually a blank.

Say a row = a line and a column a word on that line.
Create a 2 dim array with first dim >= number of lines in file
Read in file and parse words of each line into an array and add that array to the first array at its line number.
Now you can get the contents of each row and column by indexing the 2 dim array.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.