Here you can find the source of stringReplace(Map
private static String stringReplace(Map<String, String> map, String line)
//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; } }