Split text file into Strings on empty line

后端 未结 6 1432
温柔的废话
温柔的废话 2021-02-15 16:12

I want to read a local txt file and read the text in this file. After that i want to split this whole text into Strings like in the example below .

Example : Lets say

6条回答
  •  迷失自我
    2021-02-15 16:35

    I would suggest more general regexp:

    text.split("(?m)^\\s*$");
    

    In this case it would work correctly on any end-of-line convention, and also would treat the same empty and blank-space-only lines.

提交回复
热议问题