Example usage for org.apache.commons.lang3.text StrSubstitutor StrSubstitutor

List of usage examples for org.apache.commons.lang3.text StrSubstitutor StrSubstitutor

Introduction

In this page you can find the example usage for org.apache.commons.lang3.text StrSubstitutor StrSubstitutor.

Prototype

public StrSubstitutor() 

Source Link

Document

Creates a new instance with defaults for variable prefix and suffix and the escaping character.

Usage

From source file:io.fabric8.karaf.core.Support.java

public static StrSubstitutor createStrSubstitutor(String prefix, String suffix, StrLookup<String> lookup) {
    StrSubstitutor substitutor = new StrSubstitutor();
    substitutor.setEnableSubstitutionInVariables(true);
    substitutor.setVariablePrefix(prefix);
    substitutor.setVariableSuffix(suffix);
    substitutor.setVariableResolver(lookup);

    return substitutor;
}

From source file:com.hazelcast.simulator.utils.FileUtils.java

public static File newFile(String path) {
    path = path.trim();/*from   w  w w.j  a  va 2s.c om*/
    if (path.equals("~")) {
        path = USER_HOME;
    } else if (path.startsWith("~" + File.separator)) {
        path = USER_HOME + path.substring(1);
    }
    path = new StrSubstitutor().replace(path);

    return new File(path);
}