public String[] fetch_str_and_coord(String string){
String web[] = new String[3];
String temp = null;
temp = string.substring(string.indexOf("src="));
web[0] = temp.substring(temp.indexOf("\"")+1,temp.indexOf("\" "));
web[1] = temp.substring(temp.indexOf("coordX")+8,temp.indexOf("\"
coordY"));
web[2] = temp.substring(temp.indexOf("coordY")+8,temp.lastIndexOf("\"
"));
for(int i=0;i<3;i++)
{
System.out.println(web[i]);
}
return web;
}
plzz have a look at it..
Oliver Wong - 27 Jul 2006 15:07 GMT
> public String[] fetch_str_and_coord(String string){
>
[quoted text clipped - 14 lines]
> }
> plzz have a look at it..
Use the indexOf(String str, int fromIndex) instead of lastIndexOf. The
second parameter, fromIndex, tells where to start the search.
So for example, you want to search for the first "\"" that appears,
starting from when "coordY=\"" appears.
- Oliver