从字符串中删除所有字符的出现 [英] Remove all occurrences of char from string
本文介绍了从字符串中删除所有字符的出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用这个:
String str = "TextX Xto modifyX";
str = str.replace('X','');//that does not work because there is no such character ''
有没有办法从Java中的字符串中删除所有出现的字符 X
?
Is there a way to remove all occurrences of character X
from a String in Java?
我试过这个,不是我想要的: str.replace('X',''); //请替换为空格