How do I use System.getProperty(“line.separator”).toString()?

前端 未结 7 1110
Happy的楠姐
Happy的楠姐 2020-12-29 05:41

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:

http://i.st

7条回答
  •  無奈伤痛
    2020-12-29 06:01

    Try this:

    rows = tabDelimitedTable.split("[\\r\\n]+");
    

    This should work regardless of what line delimiters are in the input, and will ignore blank lines.

提交回复
热议问题