So I'm trying to make a fan java program for a game for a few of my friends, I'm trying to read the contents of a text file to store into an array/arraylist in the future but I'm unable to get string split working the way I hoped it would. I tried examples from this place that worked for people just to see if it will work but I get the same output.
importCards.java
BufferedReader in = null;
try {
in = new BufferedReader(new FileReader("dark.txt"));
String read = null;
while ((read = in.readLine()) != null) {
read = in.readLine();
String[] splited = read.split("||");
for (String part : splited) {
System.out.println(part);
}
}
} catch (IOException e) {
System.out.println("There was a problem: " + e);
e.printStackTrace();
} finally {
try {
in.close();
} catch (Exception e) {
}
}
The text file is formatted as follows
17||Dark Soul Endor||Dark||2||1||Human||Main Characters||5|500000||833||126||78||23||Release of Spirit - Dark||Dissolve all Light Runestones to inflict Dark on all enemies||Power of Dark||Dark Attack x 150%
However when I tried and printed it I got this
1
8
|
|
D
a
r
k
and so on
read.split("\\|\\|");