删除字符串Java中的单引号

时间:2022-09-15 15:15:49

I need some help to replace all the single quotes in a string.

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

This is my string: The State of the water = 'ICE'

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

I want to remove the single quotes around ICE.

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

2 个解决方案

#1


5  

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

#2


1  

Use this

用这个

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

#1


5  

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

#2


1  

Use this

用这个

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