删除不需要的空行 eclipse 编辑器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12740086/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Remove unwanted blank line eclipse editor
提问by Ankur Loriya
When i open any file in eclipse. it show alternative blank line after all the code lines and blank line. how can i remove it....
当我在 Eclipse 中打开任何文件时。它在所有代码行和空白行之后显示替代空白行。我怎样才能删除它....
回答by J4cK
In eclipse preference setting you can remove all the unwanted blank lines. Eclipse: Window > Preferences > Java > Code Style > Formatter > Edit the formatter and following screen will pop up.
在 eclipse 首选项设置中,您可以删除所有不需要的空行。Eclipse: Window > Preferences > Java > Code Style > Formatter > Edit the formatter 将弹出以下屏幕。
And when you format the code all unwanted blank lines will be removed.
当您格式化代码时,所有不需要的空行都将被删除。
回答by Anshu
Find: ^\s*\n
找: ^\s*\n
Replace with: (empty)
替换为:(空)
回答by Kano
Maybe you didn't understand what Anshu said. Do a Ctr-F on your editor. In the options, select Regular Expression.Enter ^\s*\n for the Find expression. Keep the Replace box empty. Replace All!
可能你没听懂安舒说的话。在您的编辑器上执行 Ctr-F。 在选项中,选择正则表达式。为查找表达式输入 ^\s*\n。保持替换框为空。全部替换!
This of course might lead to removal of unwanted lines as well.
这当然也可能导致删除不需要的行。
回答by Mohd Kalimullah Sheikh
Due to your eclipse setting.
由于您的日食设置。
you can change your setting from preferences.
您可以从首选项中更改您的设置。
回答by Sun
- Find and replace as Regular Expressions with ^\s*\n
- Press Ctrl + Shift + f
- Press Ctrt + Shift + o
- 使用 ^\s*\n 查找并替换为正则表达式
- 按 Ctrl + Shift + f
- 按 Ctrl + Shift + o