0

In my java program, I want to replace the © sign in a string with a space. I used replace method but it seems to not working. What would be the solution?

String text = "ABC©";

text.replace("©", " ");

System.out.println(text);

Output : ABC©

Expected output : ABC

Tom
  • 16,842
  • 17
  • 45
  • 54
ANJ
  • 301
  • 1
  • 2
  • 14

1 Answers1

4

String is immutable. Try

text = text.replace("©", "");

You can also see it in the documentation

Guy
  • 46,488
  • 10
  • 44
  • 88