Hi I'd like to replace a char in a String. My problem is that at first you don't know which char it is, so in some cases I get an error message when my char is for example '+'. I don't want my char being interpreted as regex, so what should I do?
May code should be something like this:
String test = "something";
char ca = input.chatAt(0);
input = input.replaceAll("" + ca, "");
I hope you can help me.
String.replace(from, to). Reading the javadoc is all you have to do to find these easy solutions.String.replace()instead ofString.replaceAll().