1、kotlin 版本
fun convertUploadContact(receiverIds: String?): String { val list = ArrayList() if (!TextUtils.isEmpty(receiverIds)) { val sArr = receiverIds!!.split("$") for (ss in sArr) { if(!ss.equals("")) list.add(UploadContact(ss)) } } return toJSONString(list) }
2、 Java版
public String convertUploadContact(String receiverIds) { ArrayListlist = new ArrayList<>(); if (!TextUtils.isEmpty(receiverIds)){ String[] sArr=receiverIds.split("\\$"); for (String ss : sArr) { list.add(new UploadContact(ss)); } } return ToolUtils.toJSONString(list); }