Java Map Replace replace(Map map, String text)

Here you can find the source of replace(Map map, String text)

Description

replace

License

LGPL

Declaration

public static String replace(Map<String, String> map, String text) 

Method Source Code

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

import java.util.Map;
import java.util.Map.Entry;

public class Main {
    public static String replace(Map<String, String> map, String text) {
        for (Entry<String, String> entry : map.entrySet()) {
            text = text.replaceAll(entry.getKey().replaceAll("#", "\\#"),
                    entry.getValue());//from   ww w .  j  ava 2s. co m
        }
        return text;
    }
}

Related

  1. replace(Map map, String content)
  2. replace(String originalCommand, Map vars)
  3. replace(String orign, Map replaceStringMap)
  4. replace(String s, Map map)
  5. replace(String src, String prefix, String suffix, Map props)