In the code below I have a ByteArrayOutputStream that I'm trying to loop through and the objective is trying to REPLACE the HTML equivalent (&) with the "&" character itself. The issue that I'm trying to correct is that the & value is being printed in a log and I need to correct that with "&". The code below is what I've attempted but this is NOT working.
Just in case someone else wanted to see what the answer was. Please see fix below. I also added other HTML codes I needed to fix. Thanks anyway. This came from another poster Ben from StackOverflow.com.
Well done working it out. Remember the real reason: Strings are immutable, so you get the changed version as the return value. That is what you need to keep. If you don't assign the return value to something, it disappears into cyber‑limbo never to be seen again.