MCPcopy Create free account
hub / github.com/diyhi/bbs / replace

Method replace

src/main/java/cms/utils/Placeholder.java:26–32  ·  view source on GitHub ↗

替换 @param source 源内容 @param parameter 占位符参数 @param prefix 占位符前缀 例如:${ @param suffix 占位符后缀 例如:} @param enableSubstitutionInVariables 是否在变量名称中进行替换 例如:${system-${版本}} 转义符默认为'$'。如果这个字符放在一个变量引用之前,这个引用将被忽略,不会被替换 如$${a}将直接输出${a} @return

(String source,Map<String, Object> parameter,String prefix, String suffix,boolean enableSubstitutionInVariables)

Source from the content-addressed store, hash-verified

24 * @return
25 */
26 public static String replace(String source,Map<String, Object> parameter,String prefix, String suffix,boolean enableSubstitutionInVariables){
27 //StrSubstitutor不是线程安全的类
28 StringSubstitutor strSubstitutor = new StringSubstitutor(parameter,prefix, suffix);
29 //是否在变量名称中进行替换
30 strSubstitutor.setEnableSubstitutionInVariables(enableSubstitutionInVariables);
31 return strSubstitutor.replace(source);
32 }
33
34 /**
35 * 测试

Callers 15

installMethod · 0.45
mainMethod · 0.45
escapeSQLLikeMethod · 0.45
formatPathMethod · 0.45
downloadResponseMethod · 0.45
rangeDownloadResponseMethod · 0.45
formatMethod · 0.45
toLeftSlantMethod · 0.45
toSystemPathMethod · 0.45
toUrlPathMethod · 0.45
toRelativePathMethod · 0.45
toUnderlineMethod · 0.45

Calls

no outgoing calls

Tested by 1

installMethod · 0.36