![](/img/trans.png)
[英]Java: Copy strings from a file to another without losing the 'newline format'
[英]How do you copy java code from a java file from eclipse without messing up the format?
我一直在尝试从我的 eclipse 程序中复制代码,以便我可以将 email 代码复制给与我一起工作的人,但格式混乱了。 这就是我想要的样子:
while (insOrDel) {// Asks the user for five different options:
// add a username or bot
// add a special username or bot
// remove a username or bot
// remove a special username or bot.
// list all special usernames or bots.
// list all usernames or bots
// run weblog sifter.
然而,当它从 email 中出来时,结果是这样的:
while (insOrDel) {// Asks the user for five different options:
// add a username or bot
// add a special username or bot
// remove a username or bot
// remove a special username or bot.
// list all special usernames or bots.
// list all usernames or bots
// run weblog sifter.
请记住,这是在 Ctrl+Shift+F 之后,并且由于某种原因,注释没有缩进。 有没有办法来解决这个问题?
谢谢!
当源文件使用制表符并且您粘贴代码的目标应用程序具有不同的制表符宽度时,可能会发生这种情况。
为避免这种情况,您可以在 Eclipse / Window / Preferences / General / Editors / Text Editors中设置选项“为制表符插入空格”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.