Thanks for your suggestion, I tried according but I got out of bound exception
int i=line.indexOf("<A href="); out.println(i); int len = i+"<A href=".length(); i = line.indexOf(">",len+1); out.println(i); line=line.substring(len+1,i+1); out.println(line); Please let me know if I commit any mistake in the code.
The exception will tell you which line of your code it happened on. Look at the documentation for the methods on that line and see what could cause the exception.
Joined: Oct 13, 2005
Look closely through the details of the substring() method. You may be getting problems because of the +1. In case you are getting lines ending with /a> rather than . . .>link text</a> you might try getting the index of /a> as well, and using that if it is less than the index of >. There is a simple method in the Math class which can do that for you.