【发布时间】:2020-04-19 15:10:18
【问题描述】:
所以对于我在 Android Studio 中的应用,我想替换以下内容:
String card = cards.get(count).getCard();
if (card.contains("{Player1}")) {
String replacedCard = card.replaceAll("{Player1}", "Poep");
}
String 卡的一个例子可以是:{Player1} 和你旁边的人换酒。
不知何故,我无法使用 {} 进行替换。用 { 它说:“悬空元字符”。截图:https://prnt.sc/s2bbl8
有解决办法吗?
【问题讨论】:
-
考虑使用
String.replace而不是String.replaceAll
标签: java string replaceall