我可以使用这个:
String str = "TextX Xto modifyX"; str = str.replace('X','');//that does not work because there is no such character ''
有没有办法X从Java中的字符串中删除所有出现的字符?
X
我试过了,这不是我想要的:str.replace('X',' '); //replace with space
str.replace('X',' '); //replace with space
尝试使用带参数的重载CharSequence(例如,String)而不是char:
CharSequence
String
char
str = str.replace("X", "");