简体   繁体   English

Eclipse,Java,复制代码

[英]Eclipse, java, copy code

I apologize for the stupid question. 我为这个愚蠢的问题表示歉意。 I encountered the following problem: I must copy java-code from site to Eclipse, where each line began with it's number, for example: 我遇到了以下问题:我必须将Java代码从站点复制到Eclipse,其中每行均以数字开头,例如:

49     try {
50              Object[] args = new Object[] { null, b, new Integer(0),
51                      new Integer(b.length) };
52              clazz = (Class) method.invoke(loader, args);
53          } finally {
54              method.setAccessible(false);
55          }
56          return clazz;
57     }
58  

but Eclipse, of course, doesn't recognize this code. 但是Eclipse当然不能识别此代码。 And I'm tired of manually delete numbers. 而且我讨厌手动删除数字。 Does Anybody Know how to automate this process?;) 有人知道如何自动执行此过程吗?

您可以简单地复制和粘贴,然后在日食中使用垂直选择(默认值:alt + shift + A)

You can also use the find-replace feature. 您还可以使用查找替换功能。

Just do CTRL F on the editor, in the "find" input, write 只需在编辑器上执行CTRL F ,在“查找”输入中,编写

^\d+(.*)$

And in the "replace" input field write 并在“替换”输入字段中输入

$1

Then check the "Regular expression" checkbox, and click "replace all" 然后选中“正则表达式”复选框,然后单击“全部替换”

alt+shift+A            

零件选择的排序

There's a multi-selection option (multiple lines). 有一个多选选项(多行)。

It's an icon in the toolbar under the menu. 它是菜单下工具栏中的一个图标。

The Windows shortcut is Alt + Shift + A Windows快捷键是Alt + Shift + A

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM