intellij idea 粘贴字符串如何不带换行符?

intellij idea 有时候有点过于智能化了。其中常见的一个问题就是粘贴字符串的时候,idea 自作主张的帮我们处理换行符的问题,这很违反直觉,经常在粘贴之后还得自己把 idea 帮我添加的多余的换行符删掉。
其实 idea 也可以像其他编辑器那样简单的直接粘贴,下面介绍方法。
方法/步骤
这个问题主要出现在通过+连接长字符串时。现在我们编写简单的 2 个字符串。
选中 a 字符串里面的内容,不选中最外面的 2 个引号
ctrl+v 把它粘贴到 b 字符串的 2 个引号中间,效果是这样的。
在其他编辑器中,都可以直接粘贴,而在 idea 中帮我们做了一步多余的处理,导致变成这样。

现在我们在引号中间按鼠标右键,有一个 paste simple

快捷键是 ctrl+shift+alt+v,这样就能简单粘贴了。

如若转载,请注明出处:开源字节 https://sourcebyte.vip/article/313.html
评论