代码优化

This commit is contained in:
卢春梦 2024-09-12 11:19:58 +08:00
parent 0bb1832964
commit 10e7baa995

View File

@ -40,7 +40,7 @@ public class TemplateUtil {
*/
public static String process(String template, Kv params) {
Matcher matcher = pattern.matcher(template);
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
while (matcher.find()) {
String key = matcher.group(1) != null ? matcher.group(1) : matcher.group(2);
String replacement = params.getStr(key);
@ -62,7 +62,7 @@ public class TemplateUtil {
*/
public static String safeProcess(String template, Kv params) {
Matcher matcher = pattern.matcher(template);
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
while (matcher.find()) {
String key = matcher.group(1) != null ? matcher.group(1) : matcher.group(2);
String replacement = params.getStr(key);