java.lang.NumberFormatException: For input string: "1"

at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)

在把字符串转换成整型的时候老是报错,因为数据是从excel表复制到文本文档里进行处理的。

我在控制台输出,也显示字符串就是1,看似没什么问题。

然后,我怀疑其中除了数字之外,还有其他不可见的字符,就通过StringEscapeUtils工具来把字符串连转义字符也输出,就发现了看似为1的字符串,实际为"\uFEFF1"

所以发现表面为1的字符串,还夹杂了其他字符,从而导致转换失败。

java.lang.NumberFormatException: For input string: "1" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang的更多相关文章

  1. java.lang.NumberFormatException: For input string: "1608020001 " 错误

    错误: java.lang.NumberFormatException: For input string: "1608020001 "    at java.lang.Numbe ...

  2. java.lang.NumberFormatException: For input string: "Y"

    nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database.  ...

  3. mybatis 报错:Caused by: java.lang.NumberFormatException: For input string

    mybatis的if标签之前总是使用是否为空,今天要用到字符串比较的时候遇到了困难,倒腾半天,才在一个论坛上找到解决方法.笔记一下,如下: 转自:https://code.google.com/p/m ...

  4. java.lang.NumberFormatException: For input string:"filesId"

    做项目时候,页面获取出现了这个问题.找了好久一直以为是我字段或者是数据库字段问题导致引起的. 最后才发现是 struts2中jsp我写错了一个参数,一直导致报错.后来改了就好了. 当大家遇到这个问题的 ...

  5. 解决java.lang.NumberFormatException: For input string: "id"

    今天,项目突然报"java.lang.NumberFormatException:For input string:"id"",项目框架是spring,spri ...

  6. MyBatis报错:Caused by: java.lang.NumberFormatException: For input string: "XX"

    <select id="sltTreatment" resultType="com.vitaminmd.sunny.core.bo.Treatment"& ...

  7. Caused by: java.lang.NumberFormatException: For input string: "18446744073709551615"

    问题:Caused by: java.lang.NumberFormatException: For input string: "18446744073709551615" 原因 ...

  8. Redis集群环境使用的是redis4.0.x的版本,在用java客户端jedisCluster启动集群做数据处理时报java.lang.NumberFormatException: For input string: "7003@17003"问题解决

    java.lang.NumberFormatException: For input string: "7003@17003" at java.lang.NumberFormatE ...

  9. hadoop ha环境下的datanode启动报错java.lang.NumberFormatException: For input string: "10m"

    hadoop ha环境启动start-dfs.sh的时候datanode启动不了,并且报错. [hadoop@datanode2 ~]$ cat /home/hadoop/hadoop-2.7.3/l ...

  10. java.lang.NumberFormatException: For input string: "${jdbc.maxActive}"

    一.问题 使用SpringMVC和MyBatis整合,将jdbc配置隔离出来的时候出现下面的错误,百度了很久没有找到解决方法,回家谷歌下,就找到解决方法了,不得不说谷歌就是强大,不废话,下面是具体的错 ...

随机推荐

  1. sp_helptext输出错行问题解决

    相信,大家对sp_helptext存储过程一定不陌生,它可以帮你快速获取存储过程等对象的定义.但它有一个致命的缺点就是:每行最多返回255个nvarchar类型的字符,假如有一个编写不规范的存储过程, ...

  2. Replication--分区+复制

    1>配置订阅表使用分区,在发布的项目属性中设置"复制分区方案"和"复制索引分区方案"为true,然后初始化订阅 2>在发布数据库上修改发布属性 -- ...

  3. eclipse开发hadoop2.2.0程序

    在 Eclipse 环境下可以方便地进行 Hadoop 并行程序的开发和调试.前提是安装hadoop-eclipse-plugin,利用这个 plugin, 可以在 Eclipse 中创建一个 Had ...

  4. 使用Go客户端访问MongoDB

    1.安装MongoDB 1.1 到官网:www.mongodb.org/downloads下载windows最新版本,解压到目标目录下. 1.2 创建数据存储目录 mongodb需要一个数据文件夹来保 ...

  5. jsonp的使用记录

    最近前端的同事说要写一个手机查看的html5页面,需要我提供数据. 这个很ok啊,立马写了个服务返回数据.但是对方调用不了,因为跨域了. 返回错误如下:  Failed to load xxxxxx: ...

  6. 2、ASP .NETCore 2.0之视图

    一.Razor基础 声明:Razor不是编程语言,是服务器端标记语言.Razor是一种允许开发者在网页中嵌入服务器端代码的标记语法(主要是针对VB和C#). 1.C#中Razor基本语法 (1).Ra ...

  7. PHP如何将多维数组中的数据批量插入数据库?

    PHP将多维数组中的数据批量插入到数据库中,顾名思义,需要用循环来插入. 1.循环insert into 语句,逐渐查询 <?php /* www.qSyz.net */ @mysql_conn ...

  8. 分享VMware题目解答

    VMnet1是主机模式.是一个Host-Only网络模式 192.168.1.254/24VMnet8是NAT模式.是一个NAT方式,最简单的组网方式VMnet6是手动设置的(主机.net.内部) 1 ...

  9. 案例3-ubuntu和centos中自动部署tomcat相关服务的脚本

    涉及redis,mysql,xtrabackup, tomcat 1. ubuntu中 #!/bin/bash #first, change to root #出错立刻中断 set -e apt-ge ...

  10. lexical or preprocessor issue file not found in Xcode

    The very last suggestion is all I needed to fix this issue. Close & re-open Xcode.