开发者

android/java split problem

String time = starttime.getText().toString();

String[] separated = time.split(":");

test.setText("HH:" + separated[0].toString() + "MM:" + separated[1].toString());

If i type in 11:11 in my app, i get arrayoutofboundsexc开发者_如何学Pythoneption. Ive tried trim() on the string as well. Did i miss something?


No, you didn't miss something. I guess, the input misses a colon (:). Double check the format of time right before the split operation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜