惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
H
Help Net Security
B
Blog RSS Feed
G
Google Developers Blog
博客园 - 司徒正美
MongoDB | Blog
MongoDB | Blog
量子位
博客园 - 三生石上(FineUI控件)
The Cloudflare Blog
P
Proofpoint News Feed
小众软件
小众软件
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
V
V2EX
月光博客
月光博客
C
Check Point Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
A
Arctic Wolf
Help Net Security
Help Net Security
Schneier on Security
Schneier on Security
D
DataBreaches.Net
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Palo Alto Networks Blog
T
Tenable Blog
L
LangChain Blog
Attack and Defense Labs
Attack and Defense Labs
Google DeepMind News
Google DeepMind News
N
News and Events Feed by Topic
Forbes - Security
Forbes - Security
F
Fortinet All Blogs
Recent Announcements
Recent Announcements
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
大猫的无限游戏
大猫的无限游戏
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Y
Y Combinator Blog
WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Engineering at Meta
Engineering at Meta
NISL@THU
NISL@THU
GbyAI
GbyAI
博客园 - Franky
S
Secure Thoughts
有赞技术团队
有赞技术团队
PCI Perspectives
PCI Perspectives
U
Unit 42

博客园 - powerlx

CSS3手风琴菜单 下拉展开带弹性动画 Java中用Apache POI生成excel和word文档 java 对EXCEL表格的操作。包括EXCEL 2007 include 问题 数字显示科学计数法的问题 Java 如何将String转化为Int java如何提取url里的域名 AS快捷键 Java三大主流框架概述 java 对EXCEL表格的处理 JAVA下载文件中文乱码问题 Java 判断文件夹、文件是否存在、否则创建文件夹 jspSmartUpload上传下载全攻略 intellJ实用技巧 main 方法, 老师,有没有类似微信布局的好的开源库? Android 日常开发总结的技术经验 60 条 新的android studio创建的fragment工程跟老师讲的结构有区别 默认情况下优先级应该是谁先注册谁的优先级就高吧?
java.lang.ArrayIndexOutOfBoundsException: 1
powerlx · 2016-09-05 · via 博客园 - powerlx

数组越界

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

在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();
  }

以上就是本文给大家分享的全部内容了,希望大家能够喜欢。