后端utils分割字符串
/**
* 分割字符串
*
* @return
*/
public static List<String> getIdList(String ids) {
if (StringUtils.isEmpty(ids)) {
return new ArrayList<>();
}
if (!ids.contains(",")) {
List<String> re = new ArrayList<>();
re.add(ids);
return re;
}
String[] idArr = ids.split(",");
List<String> idList = Arrays.asList(idArr);
idList = idList.stream()
.filter(id -> StringUtils.isNotEmpty(id))
.collect(Collectors.toList());
return idList;
}