前提,已经把整个源代码加到了一个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 里面明明有这两个字符串啊。谢谢大家帮忙,我会努力学习回报帮助过我的人。
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 里面明明有这两个字符串啊。谢谢大家帮忙,我会努力学习回报帮助过我的人。
解决方案 »
- 在有防火墙的不同网段中使用MINA 服务端收不到消息
- 据说这也是是google的域名 baidu.com.sb
- 帮忙看下这是什么错误,谢谢~~~~~
- 一个面试题 大家进来看看 !
- 下面程序增加什么代码后才会有弹出式菜单?
- 我记得可以在某个坐标点设置颜色,然后在这个坐标点的区域的颜色被填充了,可是不记得怎么做了
- JAVA 界面中的按钮有时候要单击两次现象,大家讨论!
- 关于系统等待wait的问题!
- 怎样用weblogic的连接池?
- Reader and Writer都是Low-Level的吗?没有High-Level的?
- java 中Windowopened事件问题
- 一个简单的QQ聊天程序,基于服务器很客户端的,但是我写好以后调试了两天都没调试出来。。。不知道错在哪里(希望大家帮帮忙,我没多少分数能给了,只剩20分)
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);
String temp=hideArea.getText().substring(hideArea.getText().indexOf("Total Downloads: </b> ")+c1,hideArea.getText().indexOf(" </li> <li> <b>Downloads last"));
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"));