Open GenweiWu opened 6 years ago
https://stackoverflow.com/a/3655963
Map<String, String> valuesMap = new HashMap<String, String>(); valuesMap.put("animal", "quick brown fox"); valuesMap.put("target", "lazy dog"); String templateString = "The ${animal} jumped over the ${target}."; StrSubstitutor sub = new StrSubstitutor(valuesMap); String resolvedString = sub.replace(templateString);
apache commons lang
https://commons.apache.org/proper/commons-lang/