我想解析一个字符串来获得3整数,但我有一个强制关闭和LogCat说:ArrayIndexOutOfBoundExceptions。Android解析字符串ArrayIndexOutOfBoundsException
这里是我的代码的相关部分:
dateModif = tvDateAffichee.getText().toString();
String[] separatedDate = dateModif.split(".");
mDay = Integer.parseInt(separatedDate[0]);
mMonth = Integer.parseInt(separatedDate[1]);
mYear = Integer.parseInt(separatedDate[2]);
我查了敬酒的字符串值,并将其包含的值等,例如:2011年9月13日
的错误来自该行:
mDay = Integer.parseInt(separatedDate[0]);
(如果我把它作为评论,它给了同样的错误弗罗姆下一行)
感谢您的帮助!
感谢您的快速答复!我知道使用真正的日期分析会更好,但它是一个非常特殊的事情。 – HerrM