本文共 745 字,大约阅读时间需要 2 分钟。
String[] panelArr = glass_id.split("\n"); StringBuffer panelSb = new StringBuffer(); for (int i = 0; i < panelArr.length; i++) { panelSb.append("'").append(panelArr[i]).append("',"); } panelSb.deleteCharAt(panelSb.length() - 1); hql.append(" AND column_nameIN (") .append(panelSb.toString()) .append(")");
--------------------------------20190313----------------------------------------------------------------
此外使用拉姆达表达式也很简便
ListpanelIds = ...; String layout; String panels = panelIds.stream() .map(p -> "'" + p.substring(0, p.length() - 2) + "'") .collect(Collectors.joining(", "));
转载地址:http://wkeqj.baihongyu.com/