public String render(Map<String, Object> data) { System.out.println(template); String template = this.template; StringBuffer sb = new StringBuffer(); for (String key : data.keySet()) { String value = (String) data.get(key); System.out.println(key + " = " + value); Matcher m = pattern.matcher(template); // TODO: while (m.find()) { if (m.group(1).equals(key)) { m.appendReplacement(sb, value); template = template.substring(m.end()); } } }
System.out.println(sb + template); return sb + template; }
欢迎大佬 多多 指教~
Sign in to make a reply
求女票上微博
public String render(Map<String, Object> data) {
System.out.println(template);
String template = this.template;
StringBuffer sb = new StringBuffer();
for (String key : data.keySet()) {
String value = (String) data.get(key);
System.out.println(key + " = " + value);
Matcher m = pattern.matcher(template);
// TODO:
while (m.find()) {
if (m.group(1).equals(key)) {
m.appendReplacement(sb, value);
template = template.substring(m.end());
}
}
}
System.out.println(sb + template);
return sb + template;
}
欢迎大佬 多多 指教~