根据正则 替换字符串内容 并返回替换内容后的字符串
发布时间:2020-12-14 01:53:53 所属栏目:百科 来源:网络整理
导读:final Pattern pattern = Pattern.compile(regex); final Matcher matcher = pattern.matcher(srcContent); final StringBuffer sb = new StringBuffer(); if (matcher.find()) { matcher.appendReplacement(sb,replaceContent); } return sb.toString();
final Pattern pattern = Pattern.compile(regex); final Matcher matcher = pattern.matcher(srcContent); final StringBuffer sb = new StringBuffer(); if (matcher.find()) { matcher.appendReplacement(sb,replaceContent); } return sb.toString(); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |