前提,已经把整个源代码加到了一个TextArea 里, 知道要的这个字符串两边肯定有一个特殊的字符串(唯一)。  int c1 = s.length();
 int c  = hideArea.getText().indexOf("Download<");
 int d  = hideArea.getText().indexOf(">is ooo<i>");
 String temp=hideArea.getText().substring(c+c1,d);
要的就是把"Download<"  和  ">is ooo<i>"  之间的字符串取出来, 这样不对吗?改了好几次,要不就是得到-1 ,要不就是 负数。 可是 hideArea 里面明明有这两个字符串啊。谢谢大家帮忙,我会努力学习回报帮助过我的人。

解决方案 »

  1.   

    没看懂你c+c1是什么意思 那岂不是从整个字符串长度+c开始?肯定要报异常的
    c获取了hideArea.getText()中“Download<”的出现位置 
    substring应该从"Download<"之后开始 也就是c+9
    直到">is ooo<i>"之前也就是 d
    改成下面的试试吧吧
    int c1 = s.length();
                 int c  = hideArea.getText().indexOf("Download<")+9;
                 int d  = hideArea.getText().indexOf(">is ooo<i>");
                 String temp=hideArea.getText().substring(c,d);
      

  2.   

    return hideArea.getText().replaceAll("(?s).*Download<", "").replaceAll("(?s)>is ooo<i>.*", "");试试
      

  3.   

    能不能这样做啊? 通过这个字段  "Download<" 将整个字符串分成2个数组。在后面的一个数组里面再通过这个字段 ">is ooo<i>" 再分成2个数组    然后得到中间的这一个数组。。 tostring一下
      

  4.   

     int c1="Total Downloads: </b> ".length();
     String temp=hideArea.getText().substring(hideArea.getText().indexOf("Total Downloads: </b> ")+c1,hideArea.getText().indexOf(" </li> <li> <b>Downloads last"));
      

  5.   

    改成下面这样也不行。
     int c1="Total Downloads: </b> ".length();
    String temp=hideArea.getText().substring(hideArea.getText().indexOf("Total Downloads: </b> ")+c1,hideArea.getText().indexOf(" </li> <li> <b>Downloads last"));