//从json对象中取出message
String message = jsonObject2.getString("message");
Pattern regex = Pattern.compile("\\$\\{([^}]*)\\}");
Matcher matcher = regex.matcher(message);
StringBuilder sb = new StringBuilder();
if (StringUtils.isNotEmpty(message)) {
while (matcher.find()) {
sb.append(matcher.group(1) + ",");
}
//删去最后一个逗号
if (sb.length() > 0) {
sb.deleteCharAt(sb.length() - 1);
}
}
String notifyParam = sb.toString();
匹配${}中的数据
最新推荐文章于 2023-03-09 05:11:39 发布