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 ...
随机推荐
- Android 学习第12课,应用出错信息
应用在运行时,出现的错误信息都会在LogCat中显示 如果调出LogCat ? 菜单:窗口 -> 显示视图 -> 其他 -> LogCat
- 《深入浅出Node.js》第8章 构建Web应用
@by Ruth92(转载请注明出处) 第8章 构建Web应用 一.基础功能 请求方法:GET.POST.HEAD.DELETE.PUT.CONNECT GET /path?foo=bar HTTP/ ...
- Day23_IO第五天
1.递归求5的阶乘 package com.heima.chario; public class Demo8_Digui { /** * @param args * 递归:方法自己调用自己 * 5! ...
- linux和windows共享文件
开发板的文档上说可以使用nfs共享文件夹,提供的命令如下: mount –t nfs –o nolock 192.168.1.244:/usr/ /mnt/ 因此我在我的win10上设了共享文件夹,然 ...
- java单例-积木系列
一步步知识点归纳吧,把以前似懂非懂,了解表面,知道点不知道面的知识归一下档. 懒汉式单例: 私有化构造函数,阻止外界实例话对象,调用getInstance静态方法,判断是否已经实例化. 为什么是懒 ...
- Oracle笔记1-数据库概念
数据库: 基本的概念:数据库管理系统(Database Management System,DBMS):管理数据的一个软件系统关系型数据库管理系统(RDBMS)数据库(Database):存放数据的磁 ...
- android驱动开发前的准备(五)
搭建S3C6410开发板的测试环境 首先安装串口调试工具 第一步:检测当前系统是否支持USB转串口 # lsmod | grep usbserial 第二步:安装minicom # apt-get i ...
- 拓展Yii Framework(易框架)
1.拓展yii 此文针对Yii1.1.15而写,请注意甄别你的Yii Framework 版本. 拓展yii是开发期间常见的代码处理方式.例如,你写一个新的controller(业务控制器),你通过继 ...
- ODOO-10.0 错误 Could not execute command 'lessc'
2017-01-05 20:24:12,473 4652 INFO None odoo.service.db: Create database `hello`. 2017-01-05 20:24:16 ...
- 关于VS2010无法编译问题
cvtres.exe 近来遇到无法编译问题,编译后debug之类文件全部为空,纠结好久才发现还是一个以前遇到解决过的问题...= = C:\Windows\Microsoft.NET\Framewor ...