I have two Strings as follow:
String input="<tr><td>Hello world</td></tr>";
String output="<body><tr><td>Hello world</td></tr></body>";
I want to compare the two strings and need to remove the <body></body> tags from the output string if the input string doesn’t contain <body> tag. The string may be of any length.
How to compare and replace the output string based on input string?
<body> tag may be anything like <body ></body > or < body>< /body>,etc.
Need to find the tag and replace it based on input string.
1 Answer