语句: String src=contect.substring(contect.indexOf("src")+5,contect.indexOf("/>"))
content内容:免费实际生的一人姑地大真舒服夺大哥一大幅度圾百无一用一夺要 厅 震 在蛋一和 在仍在圾寻一三须脤 在不顾一切胡辱辱 在真舒服柘城夺 夺有 一一一有豕一有表知互利互惠拍胡一膨大圾在fe<br />
<img height="338" width="500" alt="" src="/bkzj/UserFiles/Image/ceshi(2).jpg" />
执行这一句时报错:java.lang.StringIndexOutOfBoundsException: String index out of range: -39
at java.lang.String.substring(Unknown Source)
at blog.web.NoticeAction.saveNotice(NoticeAction.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
.........................
content内容:免费实际生的一人姑地大真舒服夺大哥一大幅度圾百无一用一夺要 厅 震 在蛋一和 在仍在圾寻一三须脤 在不顾一切胡辱辱 在真舒服柘城夺 夺有 一一一有豕一有表知互利互惠拍胡一膨大圾在fe<br />
<img height="338" width="500" alt="" src="/bkzj/UserFiles/Image/ceshi(2).jpg" />
执行这一句时报错:java.lang.StringIndexOutOfBoundsException: String index out of range: -39
at java.lang.String.substring(Unknown Source)
at blog.web.NoticeAction.saveNotice(NoticeAction.java:354)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
.........................
解决方案 »
- Struts2 s:radio 怎么显示默认的属性
- 跪求,开发sip的代理服务器(proxy),大家给我点意见!
- j2me 调用.net的WebService传输中文到.net WebService时中文都是乱码,如何解决
- 大家来帮我看看这个上传图片的代码到底有什么问题,急!谢谢大家了
- JavaScript ,获取行号问题
- 怎样解决这个简单的问题:package javax.media does not exist at line... ?我用的编译器是JBuilderX
- 我配置tomcat5.0遇到的问题!
- 怎样在会话BEAN中返回结果集
- 为什么我在客户端调用BMP中查找方法是总是返回null.
- 为什么把.class文件删除了,jsp还能正常运行?
- MyEclipse下新建一个 EJB Project和Web Project的区别是什么?JSP/Servlet等组件可以部署在EJB Project下面吗?
- response
这样子看看
试试这样行不
int imgIndex = content.indexOf("img");
if (imgIndex != -1) {
imgIndex = content.indexOf("src", imgIndex);
int endIndex = content.indexOf("\"", imgIndex + 5);
System.out.println(content.substring(imgIndex + 5, endIndex));
}
lastIndexOf("\"/>");
这样我想就应该可以了吧