Java Map Replace stringReplace(Map map, String line)

Here you can find the source of stringReplace(Map map, String line)

Description

string Replace

License

Apache License

Declaration

private static String stringReplace(Map<String, String> map, String line) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Map;

public class Main {
    private static String stringReplace(Map<String, String> map, String line) {
        String tmp = line;/*from   w  ww .  j  a  va2s  . c om*/
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String target = entry.getKey();
            String replacement = entry.getValue();
            tmp = tmp.replace(target, replacement);
        }
        return tmp;
    }
}

Related

  1. replaceValuesToSynonyms(Map dic, Map synonims)
  2. replaceVariable(final String src, final Map value)
  3. replaceVariables(String chart, Map variables)
  4. replaceVars(String origString, Map vars)
  5. replaceVars(String s, Map m)
  6. unescape(String cooked, char escapeChar, Map replacements)
  7. zipToMap(String[] searchStrings, String[] replacements)