我不断得到字符串索引,我不知道问题出在哪里
String username, userDisplayName;while (commentBody.contains("[~")) { username = commentBody.substring(commentBody.indexOf("[~")+2, commentBody.indexOf("]")); try { userDisplayName = connector.getUserByUsername(username).get().getDisplayName(); commentBody = commentBody.replace("[~" + username + "]", userDisplayName); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); }}
ibeautiful
桃花长相依
相关分类