List of utility methods to do Map Replace
String | replace(String template, Map replace if (funcAndDic == null) { return template; for (Entry<String, String> entry : funcAndDic.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); String[] items = key.split("-"); String replaceStr = items[1].replaceAll("\\$", "\\\\\\$").replaceAll("\\{", "\\\\\\{") ... |
String | replace(String text, Map replace StringBuilder result = new StringBuilder(text); for (String old : pairs.keySet()) { if (old != null) { if (!old.equals("")) { replaceString(result, old, pairs.get(old)); return result.toString(); |
String | replace2(String str, Map Replace 2. for (String key : data.keySet()) { str = str.replaceAll(key, data.get(key)); return str; |
String | replaceAll(Map Substitute all global variables of the form $(KEY) in a string. String retval = value; if (value != null && globals != null) { for (String key : globals.keySet()) { String var = "${" + key + "}"; if (value.contains(var) && globals.get(key) != null) { retval = retval.replace(var, globals.get(key)); return retval; |
String | replaceAll(String inTemplate, Map replace All if (inTemplate == null || inVars == null) { return inTemplate; for (final Entry<String, String> e : inVars.entrySet()) { if (e.getKey() == null) { continue; inTemplate = inTemplate.replace(e.getKey(), e.getValue() == null ? e.getKey() : e.getValue()); ... |
String | replaceAll(String template, Map Given a raw input string template, this will do a mass search and replace for the map of variables to values. if (template == null || variables == null || variables.isEmpty()) { return template; for (Map.Entry<String, String> entry : variables.entrySet()) { String value = entry.getValue(); if (value == null) { value = EMPTY; } else { ... |
String | replaceAllOccurrences(String str, Map replace All Occurrences Set<Map.Entry<String, String>> entries = replacementMap.entrySet(); Iterator<Map.Entry<String, String>> it = entries.iterator(); while (it.hasNext()) { Map.Entry<String, String> entry = it.next(); str = replaceOccurrences(str, entry.getKey(), entry.getValue()); return str; |
String | replaceAllRegex(String input, Map replace All Regex if (input == null) { return null; Iterator<Entry<String, String>> replacementsI = replacements.entrySet().iterator(); Entry<String, String> replacement; String current = input; while (replacementsI.hasNext()) { replacement = replacementsI.next(); ... |
String | replaceByMap(String _searchStr, Map Replace all placeholders in given string by value of the corresponding key in given Map. if (_searchStr == null) { return null; if (_replacements == null || _replacements.isEmpty()) { return _searchStr; String str = _searchStr; for (Entry<String, String> entry : _replacements.entrySet()) { ... |
String | replaceByMap(String tpl, Map replace like xxxx{key}yyy{key}zzzz if (tpl != null && map != null && map.size() > 0) { for (String key : map.keySet()) { tpl = tpl.replace("{" + key + "}", String.valueOf(map.get(key))); return tpl; |