Java replaceAll函数的字符串不替换

oli*_*dev 3 java

可能重复:
使用replaceall输出错误

如果我有字符串:

String test = "replace()thisquotes";

test = test.replaceAll("()", "");
Run Code Online (Sandbox Code Playgroud)

测试结果仍然是: test = "replace()thisquotes"

所以()没有被替换.

有任何想法吗?

Boz*_*zho 11

你不需要正则表达式,所以使用:

test.replace("()", "")
Run Code Online (Sandbox Code Playgroud)