删除字符串Java中的单引号

时间:2015-08-12 07:59:49

标签: java regex string

我需要一些帮助来替换字符串中的所有单引号。

这是我的字符串:水的状态='ICE'

我想删除ICE周围的单引号。

2 个答案:

答案 0 :(得分:7)

str = str.replaceAll("\'","");

答案 1 :(得分:2)

使用此

String str = "The State of the water = 'ICE'";
str = str.replaceAll("'","");