All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bardframework.commons.utils.StringTemplateUtils Maven / Gradle / Ivy

There is a newer version: 3.6.1
Show newest version
package org.bardframework.commons.utils;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringSubstitutor;

import java.util.Map;

public class StringTemplateUtils {

    public static String fillTemplate(String template, Map args) {
        return StringTemplateUtils.fillTemplate(template, "::", "::", args);
    }

    public static String fillTemplate(String template, String prefix, String suffix, Map args) {
        if (StringUtils.isBlank(template)) {
            return template;
        }
        return new StringSubstitutor(args, prefix, suffix).replace(template);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy