I have a Tab-delimited String (representing a table) that is passed to my method. When I print it to the command line, it appears like a table with rows:
https://i.stack.imgur.com/2fAyq.gif
The command window is correctly buffered. My thinking is that there is definitely a new line character before or after each row.
My problem is that I want to split up the incoming string into individual strings representing the rows of the table. So far I have:
private static final String newLine = System.getProperty("line.separator").toString();
private static final String tab = "\t";
private static String[] rows;
...
rows = tabDelimitedTable.split(newLine); //problem is here
System.out.println();
System.out.println("################### start debug ####################");
System.out.println((tabDelimitedTable.contains(newLine)) ? "True" : "False");
System.out.println("#################### end debug###################");
System.out.println();
output:
################### start debug ####################
False
#################### end debug###################
Obviously there is something in the string telling the OS to start a new line. Yet it apparently contains no newline characters.
Running the latest JDK on Windows XP SP3.
Any Ideas?
Try
This should solve the regex problem.
Also not that important but return type of
is String so no need to call toString().