Paul Clapham wrote:Well, this page on the web says there is, and it gives details.
Warning: the answer was posted 8 years ago. (Although I believe you have an old Eclipse version, so maybe that doesn't matter that much.) And also there's a fair bit of squabbling about just how to do it and whether to use regular expressions and if so which ones. But you might be able to pick a correct answer out of all that.
Junilu Lacar wrote:Why would you want to remove all blank lines? What do you think you're saving by doing this?
Whitespace is important in a program, especially when used judiciously. Whitespace makes your program easier to read, it helps you separate things that logically belong together from other things, and it helps make the structure of your code easier to discern.
Code without any blank lines at all would be horrific to read.
Tim Holloway wrote:You can always select, cursor up/down as many lines as you want to delete, then hit the "delete" key.
Eclipse has lots of ways to select, insert and delete text, and many of them are just the same as they would be with almost any other text editing program such as Microsoft Word.
Tim Holloway wrote:That doesn't sound like you're actually deleting lines, it sounds like you're just blanking them out.
Paul Clapham wrote:Original code:
Deleting the middle line:
Blanking out the middle line:
Monica Shiralkar wrote:Yes I can delete using control D but for that I have to do that for so many blanks again and again.These blanks get unevenly created when I type some line to code and then delete it to type something else.
Monica Shiralkar wrote:Not guessing a lot but it happens that one writes a statement and then does mistake and rewrites it until it works.
Tim Holloway wrote:
But even without a VCS like git, Eclipse itself keeps a history of changes. Several days worth, in fact.