![](/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.