Remove all empty lines

后端 未结 7 1664
误落风尘
误落风尘 2020-11-27 17:22

I thought that wasn\'t that hard to do, but I want to remove all empty lines (or lines just containing blanks and tabs in Java) with String.replaceAll.

My regex look

7条回答
  •  广开言路
    2020-11-27 17:52

    If want to remove the lines from Microsoft Office, Windows or an text editor which supports regular expression rendering:

     1. Press Ctrl + F.
     2. Check the regular expression checkbox
     3. Enter Expression ^\s*\n into the find box as it is.
    

    You will see all you black spaces into your editor disappears...

提交回复
热议问题