Java Map Replace replace2(String str, Map data)

Here you can find the source of replace2(String str, Map data)

Description

Replace 2.

License

Apache License

Parameter

Parameter Description
str the str
data the data

Return

the string

Declaration

public static String replace2(String str, Map<String, String> data) 

Method Source Code


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

import java.util.Map;

public class Main {
    /**/*w  ww . j  a  v a 2s  . c o  m*/
     * Replace 2.
     *
     * @param str  the str
     * @param data the data
     * @return the string
     */
    public static String replace2(String str, Map<String, String> data) {

        for (String key : data.keySet()) {
            str = str.replaceAll(key, data.get(key));
        }
        return str;
    }
}

Related

  1. replace(String string, Map values)
  2. replace(String target, Map arguments)
  3. replace(String temp, Map tags)
  4. replace(String template, Map funcAndDic)
  5. replace(String text, Map pairs)
  6. replaceAll(Map globals, String value)
  7. replaceAll(String inTemplate, Map inVars)
  8. replaceAll(String template, Map variables)
  9. replaceAllOccurrences(String str, Map replacementMap)