I'm trying to split lines in this file eng-pol.txt by new line symbol "\n" and it's simply not working... I've tried:
String[] words = strLine.split("\n");
System.out.println(Arrays.toString(words));
[abbot abbot [ˈæbət] <N>\n opat]
String[] words = strLine.split("\\n");
System.out.println(Arrays.toString(words));
[abbot abbot [ˈæbət] <N>\n opat]
String[] words = strLine.split("\\r|\r");
System.out.println(Arrays.toString(words));
[abbot abbot [ˈæbət] <N>\n opat]
Even this:
String[] words = strLine.split(System.getProperty("line.separator"));
System.out.println(Arrays.toString(words));
[abbot abbot [ˈæbət] <N>\n opat]
I'm reading the file using BufferedReader
and readLine
method.