java.lang.ArrayIndexOutOfBoundsException: 1
数组越界
但是我这个也不是这个原因:
在CuiShouDetail.jsp 里,如果 添加上 QiTaDianHua,如果为空就会报错,别的都么有问题null,或者是空格,或者是有数据
1. String.trim()
trim()是去掉首尾空格
2.str.replace(" ", ""); 去掉所有空格,包括首尾、中间
String str = " hell o ";
String str2 = str.replaceAll(" ", "");
System.out.println(str2);
3.或者replaceAll(" +",""); 去掉所有空格
4.str = .replaceAll("\s*", "");
可以替换大部分空白字符, 不限于空格
s 可以匹配空格、制表符、换页符等空白字符的其中任意一个
5.或者下面的代码也可以去掉所有空格,包括首尾、中间
public String remove(String resource,char ch)
{
StringBuffer buffer=new StringBuffer();
int position=0;
char currentChar; while(position<resource.length())
{
currentChar=resource.charAt(position++);
if(currentChar!=ch) buffer.append(currentChar); } return buffer.toString();
}
以上就是本文给大家分享的全部内容了,希望大家能够喜欢。
java.lang.ArrayIndexOutOfBoundsException: 1的更多相关文章
- Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
场景:eclipse中编写java中用到数组 问题: 程序不报错但是运行过程中 终止,显示字样 “ Exception in thread "main" java.lang.Arr ...
- java 中 java.lang.ArrayIndexOutOfBoundsException: 0 异常
package test; public class Test { public static void main(String[] args) { final int num2 = Integer. ...
- ListView中使用type需要注意的东西 java.lang.ArrayIndexOutOfBoundsException: length=2; index=2 addScrapView
ListView中使用type需要注意的东西 在使用ListView时,如果使用了getItemViewType, 记得他的值一定要是从0开始计数的. 且要覆盖getViewTypeCount方法.并 ...
- Java - 错误: "java.lang.ArrayIndexOutOfBoundsException: length=1; index=1"
错误: "java.lang.ArrayIndexOutOfBoundsException: length=1; index=1" 本文地址: http://blog.csdn.n ...
- android listview Caused by: java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
android listview 适配器在多种类型viewType报错: Caused by: java.lang.ArrayIndexOutOfBoundsException: length=3; ...
- java.lang.ArrayIndexOutOfBoundsException
1.错误描述 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at com.you.m ...
- Android BaseAdapter加载多个不同的Item布局时出现UncaughtException in Thread main java.lang.ArrayIndexOutOfBoundsException: length=15; index=15
java.lang.ArrayIndexOutOfBoundsException: length=15; index=15 异常出现的场景:在做聊天界面时,需要插入表情,图片,文字,名片,还有几种较为 ...
- Tomcat 或JBOSS java.lang.ArrayIndexOutOfBoundsException: 8192 解决方案【转】
错误信息: 2017-1-17 10:09:39 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() ...
- 解决Redisson出现Failed to instantiate [org.redisson.api.RedissonClient]: Factory method 'create' threw exception; nested exception is java.lang.ArrayIndexOutOfBoundsException: 0的问题
一.背景 最近项目中使用了redisson的哨兵模式来作为redis操作的客户端,然后一个意外出现了,启动报:Failed to instantiate [org.redisson.api.Redis ...
- Jmeter报错之jmeter.gui.action.ActionRouter: Error processing gui.action.Start@1b7c473a java.lang.ArrayIndexOutOfBoundsException
一个使用了很久的Jmeter脚本,运行时Jmeter的UI界面上点击绿色按钮后,完全无反应,只有log报错,如下: 2017/06/28 14:29:23 ERROR - jmeter.gui.act ...
随机推荐
- springmvc学习笔记--ueditor和springmvc的集成
前言: 在web开发中, 富文本的编辑器真心很重要. 有电商店铺的打理, 新闻稿/博客文章/论坛帖子的编辑等等, 这种所见即所的编辑方式, 大大方便了非技术人员从事互利网相关的工作. 因为手头有个小项 ...
- 关于ArcGis的二次开发-基于ArcEngine10.2(内有安装包)
网上很少有arcgis engine10.2的安装包,在这里我把安装包链接附上,是百度云,有需要的可以自己下--http://pan.baidu.com/s/1mhIhYYG 顺带着把arcgis d ...
- SQL server2008-对象资源管理器-数据库
数据库:系统数据库(master.model.msdb.tempdb).数据库快照.自定义数据库组成 三部分组成. master:Master数据库是SQL Server中最重要的系统数据库,记录了S ...
- Oracle执行时间与sql格式
今天碰到一个很奇怪的问题,直接在eclipse中将sql拷出,然后直接粘贴复制在数据库中就会执行的非常慢,但是在利用plsql对sql语句进行格式整理之后,执行的速度就非常的快,之后我where条件中 ...
- 使用cordova插件barcodescanner遇到的坑
最近接手了一个app任务,由于不懂android和ios,只想简单点写代码,所以,最终采用了基于H5的web框架:ionic + cordova(也叫phonegap)来开发.app的设计中有一个扫描 ...
- 王爽<<汇编语言>> 实验十四
;以"年/月/日 时:分:秒"的格式, 显示当前的日期, 时间 assume cs:code code segment main: out 70h,al ;告诉CMOS RAM将要 ...
- Codeforces Round #361 Jul.6th A题 ☺译
A.迈克和手机 当迈克在沙滩上游泳的时候,他意外的把他的手机扔进了水里.不过你甭担心因为他立马买了个便宜些的代替品,这个代替品是老款九键键盘,这个键盘只有十个等大的数字按键,按以下方式排列: 1 2 ...
- 《Matrix Computation 3rd》读书笔记——第4章 特殊线性系统
- etcd第三集
简单说下golang的etcd接口例子.etcd api有v2(http+json)和v3(grpc)两个版本,目前大家都用v2,所以... v2: https://github.com/coreos ...
- 安装恢复Windows10各种坑
1.安装Windows10最好用微软原装ISO,其它的第三方坑比较多,要么不支持UEFI,要么不支持MBR,要么不支持GPT. 2.恢复系统可以使用WIM备份,或Window原生备份,或者Ghost备 ...