数组越界

但是我这个也不是这个原因:

在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的更多相关文章

  1. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

    场景:eclipse中编写java中用到数组 问题: 程序不报错但是运行过程中 终止,显示字样 “ Exception in thread "main" java.lang.Arr ...

  2. java 中 java.lang.ArrayIndexOutOfBoundsException: 0 异常

    package test; public class Test { public static void main(String[] args) { final int num2 = Integer. ...

  3. ListView中使用type需要注意的东西 java.lang.ArrayIndexOutOfBoundsException: length=2; index=2 addScrapView

    ListView中使用type需要注意的东西 在使用ListView时,如果使用了getItemViewType, 记得他的值一定要是从0开始计数的. 且要覆盖getViewTypeCount方法.并 ...

  4. Java - 错误: &quot;java.lang.ArrayIndexOutOfBoundsException: length=1; index=1&quot;

    错误: "java.lang.ArrayIndexOutOfBoundsException: length=1; index=1" 本文地址: http://blog.csdn.n ...

  5. android listview Caused by: java.lang.ArrayIndexOutOfBoundsException: length=3; index=3

    android listview 适配器在多种类型viewType报错: Caused by: java.lang.ArrayIndexOutOfBoundsException: length=3; ...

  6. java.lang.ArrayIndexOutOfBoundsException

    1.错误描述 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at com.you.m ...

  7. Android BaseAdapter加载多个不同的Item布局时出现UncaughtException in Thread main java.lang.ArrayIndexOutOfBoundsException: length=15; index=15

    java.lang.ArrayIndexOutOfBoundsException: length=15; index=15 异常出现的场景:在做聊天界面时,需要插入表情,图片,文字,名片,还有几种较为 ...

  8. Tomcat 或JBOSS java.lang.ArrayIndexOutOfBoundsException: 8192 解决方案【转】

    错误信息: 2017-1-17 10:09:39 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() ...

  9. 解决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 ...

  10. 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 ...

随机推荐

  1. swf格式文件如何修改里面的动作路径或者动作脚本(没有源文件的情况)

    一.UrlActionEditor汉化版,这个工具是非常的简单和使用,直接把你需要需要修改的swf格式的flash文件在这里面打开 二.如果需要更加详细的修改可以下载一个SWFDecompiler4. ...

  2. UDP的使用

    // //  该类管理所有的UDP发送 #import <Foundation/Foundation.h> #import "AsyncUdpSocket.h" @pr ...

  3. 最小生成树——prim算法

    prim算法是选取任意一个顶点作为树的一个节点,然后贪心的选取离这棵树最近的点,直到连上所有的点并且不够成环,它的时间复杂度为o(v^2) #include<iostream>#inclu ...

  4. GitHub的用法:到GitHub上部署项目

    先提供两个较好的Git教程: 1. 如何在github部署项目: lhttp://jingyan.baidu.com/article/656db918fbf70ce381249c15.html 2. ...

  5. 解决Oracle在scott用户下创建视图(VIEW)权限不足的方法

    问题描述:在scott用户下创建视图的时候,报错:权限不足.(其他用户以此类推)解决方法: 以dba用户登录 sqlplus / as sysdba 赋予scott用户创建VIEW的权限 grant  ...

  6. 数论 UVALive 2911

    这道题是一道数论题. 题目的意思是告诉m.p.a.b,并且告诉你xi满足的两个条件.让你求出 xp1 + xp2 +...+ xpm 的最大值(其中p<=12,切p是偶数). 这里需要对于xi所 ...

  7. Equls 和==的区别

    对于值类型,如果对象的值相等,则相等运算符 (==) 返回 true,否则返回 false.对于string 以外的引用类型,如果两个对象引用同一个对象,则 == 返回 true.对于 string ...

  8. jsp连接SQL Server数据库的方式

    方式1:JDBC连接方式 Connection conn = null; Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDrive ...

  9. 安卓开发学习经历2--《第一行代码》coolweather项目SQL语句同一个“陷阱”掉两次 注意转义字符等特殊字符正确书写 关于Id字段自增加体会

    今天,在运行<第一行代码>coolweather第二阶段代码,又一次报错,还是神奇地与昨天相似,提示,city_id字段不存在,这里我有两种理解,一种是sql语句出错了,另外一种是没有获取 ...

  10. Ubuntu学习——第一篇

    一. Ubuntu简介 Ubuntu(乌班图)是一个基于Debian的以桌面应用为主的Linux操作系统,据说其名称来自非洲南部祖鲁语或科萨语的“ubuntu”一词,意思是“人性”.“我的存在是因为大 ...