code: public static String mergeFromTemplate(String template, Map<String, ?> values) {
          for (String param : values.keySet()) {
              template = template.replace("{{" + param + "}}", values.get(param) == null ? "" : values.get(param).toString());
          }
          return template.replaceAll("\n|\r|  ", "");
      }
docs: Merges from string as template.
  
  @param template template content, with placeholders like: {{name}}
  @param values  map with values to merge