Java字符串替换无法正常工作
String delimiter = "\\*\\*";
String html = "<html><head></head><body>**USERNAME** AND **PASSWORD**</body></html>";
Map<String, String> mp = new HashMap<String, String>();
mp.put("USERNAME", "User A");
mp.put("PASSWORD", "B");
for (Entry<String, String> entry : mp.entrySet()) {
html.replace(delimiter + entry.getKey()+ delimiter, entry.getValue());
}
这应该通常取代这两个字符串,但事实并非如此。有没有人有想法?
慕桂英3389331
萧十郎
慕的地10843
相关分类