I am trying to decode the HTML single quote entity that I have in a given string using the replace method, but it doesn't seem to work that way. Here is the block of code for testing,
String s = "I've been going to school since 1999.";
System.out.println(s.contains("'"));
s.replace("'", "\'");
System.out.println(s);
This is the result I get when I run the above.
true
I've been going to school since 1999.
Why does contains method returns true but replace method doesn't do anything?
I read some posts about using the Apache commons lang library, but I am not familiar with how to use the library so I was trying to look for a simpler way to fix this.
Any advice would be appreciated. Thanks.