-3

I´m trying to replace some characters in my string but it isnt working. Can you please help me?

My code is:

String test = "ABC?!";
test = test.replaceAll("\\?","");
test= test.replaceAll("\\!, "");

Thank you so much for helping me.

Sarah Xoxo
  • 115
  • 6

1 Answers1

3

Try str.replaceAll("[?!]", "");

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
Adya
  • 1,084
  • 9
  • 17