Skip to content

表达式替换

bash
     <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.9</version>
        </dependency>
java
StringSubstitutor

  Map<String, String> map = new HashMap<>();
        map.put("name","张三");
        map.put("age","18");

StringSubstitutor stringSubstitutor = new StringSubstitutor(map);
        return stringSubstitutor.replace(template);