【发布时间】:2020-06-16 21:13:09
【问题描述】:
简单的一行代码:
String thing = "Something";
thing += " something else" + " and more.";
IntelliJ IDEA 提供将此行更改为 4 种其他方式来实现相同的结果:
String.format()
StringBuilder.append()
java.text.MessageFormat.format()
Replace += with =
为什么? += 有什么问题?任何人都可以解释一下吗?谢谢。
【问题讨论】:
-
这些建议称为意向操作。它们可以在 File | 中找到/启用/禁用。设置 |编辑 |意图(见jetbrains.com/help/idea/intention-actions.html)
-
标题含糊。重写以总结您的具体技术问题。
标签: java string intellij-idea string-concatenation intellij-inspections