例如:

"I don't like these "double" quotes"

我希望输出是
I don't like these double quotes

最佳答案

使用 String#replace()

用空格替换它们(根据您的问题标题):

System.out.println("I don't like these \"double\" quotes".replace("\"", " "));

上面也可以用字符来完成:
System.out.println("I don't like these \"double\" quotes".replace('"', ' '));

删除它们(按照您的示例):
System.out.println("I don't like these \"double\" quotes".replace("\"", ""));

08-20 01:25