方法显示从android中的字符串中提取子字符串时的异常

时间:2018-03-24 06:16:15

标签: java android exception substring

我尝试使用下面附带的方法将 UTC日期String转换为当前日期String

方法在提到的行中抛出Index out of bound Exception

Image

1 个答案:

答案 0 :(得分:1)

<a onclick="openwindow()" style="cursor:pointer">Business List</a> 中没有(字符,因此utcDate将返回-1。然后你从{0}索引到-1索引indexOf()。但是String中字符数组的最小索引是0.因此导致substring()

请参阅:String#substring()。在文件中它说抛出 如果beginIndex大于endIndex,则IndexOutOfBoundsException

相关问题