/** * Parse an userIDS text into a list. * * @param userIDsText the userIDs text. * @param homeServerSuffix the home server suffix * @return the userIDs list. */ public static ArrayList<String> parseUserIDsList(String userIDsText, String homeServerSuffix) { ArrayList<String> userIDsList = new ArrayList<String>(); if (!TextUtils.isEmpty(userIDsText)) { userIDsText = userIDsText.trim(); if (!TextUtils.isEmpty(userIDsText)) { // they are separated by a ; String[] splitItems = userIDsText.split(";"); for (int i = 0; i < splitItems.length; i++) { String item = splitItems[i]; // avoid null name if (item.length() > 0) { // add missing @ or home suffix String checkedItem = CommonActivityUtils.checkUserId(item, homeServerSuffix); // not yet added ? -> add it if (userIDsList.indexOf(checkedItem) < 0) { checkedItem.trim(); userIDsList.add(checkedItem); } } } } } return userIDsList; }