The list of methods to do Map Replace are organized into topic(s).
String
replace(Map map, String content) replace
if (content == null) {
return null;
Map<String, String> newmap = new HashMap<String, String>();
for (String key : map.keySet()) {
if (map.get(key) != null) {
newmap.put("${" + key + "}", map.get(key));
for (String key : newmap.keySet()) {
String old = "";
do {
old = content;
content = content.replace(key, newmap.get(key));
} while (!old.equals(content));
return content;
String
replace(Map map, String text) replace
for (Entry<String, String> entry : map.entrySet()) {
text = text.replaceAll(entry.getKey().replaceAll("#", "\\#"), entry.getValue());
return text;
String
replace(String originalCommand, Map vars) Replace parameterized value on a given script
if (originalCommand == null) {
return null;
vars.remove("_");
StringBuilder sb = new StringBuilder();
for (String variable : vars.keySet()) {
if (originalCommand.contains(variable)) {
sb.append(variable).append("=\"").append(vars.get(variable)).append("\"\n");
...
String
replace(String orign, Map replaceStringMap) replace class Name by class full Name for example change List to java.util.List if class Name contains .
int index = orign.indexOf(".");
String checkName = orign;
if (index != -1) {
checkName = orign.substring(0, index);
String result = orign;
if (replaceStringMap.get(checkName) != null) {
String classFullName = ((String) replaceStringMap.get(checkName));
...
String
replace(String s, Map map) replace
StringBuilder ret = new StringBuilder((int) (s.length() * 1.5));
int cursor = 0;
for (int start, end; (start = s.indexOf("${", cursor)) != -1 && (end = s.indexOf("}", start)) != -1;) {
ret.append(s.substring(cursor, start)).append(map.get(s.substring(start + 2, end)));
cursor = end + 1;
ret.append(s.substring(cursor, s.length()));
return ret.toString();
...
String
replace(String src, String prefix, String suffix, Map props) replace a symbol in a string;
int index1;
int index2;
int len1 = prefix.length();
int len2 = suffix.length();
StringBuffer sb = new StringBuffer();
index1 = src.indexOf(prefix);
while (index1 >= 0) {
sb.append(src.substring(0, index1));
...
String
replace(String str, Map values) This method replaces ${var} substring by values stored in a map.
int len = str.length();
StringBuffer sb = new StringBuffer(len);
int prev = 0;
int start = str.indexOf("${");
int end = str.indexOf("}", start);
while (start != -1 && end != -1) {
String key = str.substring(start + 2, end);
Object value = values.get(key);
...
String
replace(String string, Map values) replace
StringBuilder sb = new StringBuilder(string);
int i = sb.indexOf("${");
while (i >= 0) {
int j = sb.indexOf("}", i + 2);
String name = sb.substring(i + 2, j);
String value = (String) values.get(name);
if (value == null)
value = "";
...
String
replace(String target, Map arguments) Replace the substrings that match with mask
<argument.key> with
argument.value
return replace(target, arguments, LEFT_LIMITER, RIGHT_LIMITER);
String
replace(String temp, Map tags) This is almost a dummy method, although it works as desired.
for (Entry<String, String> e : tags.entrySet()) {
temp = temp.replaceAll("\\{\\{" + e.getKey() + "\\}\\}", e.getValue());
return temp;