So basically what Im trying to do is make a vocab practice game in java. I have java reading the .txt file and reporting them to the console. The data is separated by the "|" character because I use commas in my .txt file.
Here Is The Code.
package sat.vocab.practice;
import java.io.FileReader;
import com.opencsv.CSVReader;
import java.util.Arrays;
public class SATVocabPractice {
@SuppressWarnings("resource")
public static void main(String[] args) throws Exception {
CSVReader reader = new CSVReader(new FileReader("C:/Users/Jordan/Documents/GitHub/SAT-Vocab-Practice--New-/src/sat/vocab/practice/Words.txt"), '|' , '"' , 0);
String[] nextLine;
while ((nextLine = reader.readNext()) != null) {
if (nextLine != null) {
System.out.println(Arrays.toString(nextLine));
}
}
}
}
The words are formatted as follows.
Word | Type of Speach: Definition
labyrinth|n: 1. an intricate combination of paths or passages in which it is difficult to find one's way or to reach the exit. 2. any confusingly intricate state of things or events; a bewildering complex.
cower|v: 1. to crouch, as in fear or shame.
The Data That We Get Back From The Code Is Formatted As [ cower|v: 1. to crouch, as in fear or shame.]
I need the data to go into two array lists one for words (before the |) and one for definitions (after the |).