Removing new lines and returning from HTML using Java

I am parsing HTML content using Java and am trying to remove \ r \ n from \ r \ n I used the following code in my program to try and remove the \ r \ n, but it doesn't work.

attribute = attribute.replaceAll("(\\r|\\n|\\t)", "");

      

How can this code be adjusted to convert \ r \ n26.11.2012 to 26.11.2012?

+3


source to share


1 answer


        TestCase.assertEquals("26.11.2012", "\r\n26.11.2012".replaceAll("(\\r|\\n|\\t)", ""));

      



Your code actually works. This test passes. Perhaps the input is not what you expect, or the attribute value is being processed in the output and this has added characters.

+1


source







All Articles