删除字符串中的单引号 Java
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31959352/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 19:24:58 来源:igfitidea点击:
Remove single quotes in a string Java
提问by fiddle
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 周围的单引号。
回答by wawek
str = str.replaceAll("\'","");
回答by Harshit Shrivastava
Use this
用这个
String str = "The State of the water = 'ICE'";
str = str.replaceAll("'","");