0

My String is

           **abcd
           *[abc]
           <td> **Welcome
               **Welcome Again
           </td>

Is their any way in which I can remove the * symbol in between the tags so that my final string string would be something like

            **abcd
             *[abc]
          <td> Welcome
               Welcome Again
           </td>

Here all the * between <td> and </td> are removed I dont want to use string.

1 Answers1

1

Try this,

    if (s.contains("<td>"))
    {
        String first = s.substring(0, s.indexOf("<td>"));
        String last = s.substring(s.indexOf("<td>"), s.indexOf("</td>") + 5);

        System.out.println("result  : "+first + last.replace("**", ""));
    }
    else
    {
        System.out.println("result : "+s);
    }
newuser
  • 8,338
  • 2
  • 25
  • 33