Android String Replace replaceString(String s, Map replacement)

Here you can find the source of replaceString(String s, Map replacement)

Description

replace String

Declaration

public static final String replaceString(String s,
            Map<String, String> replacement) 

Method Source Code

//package com.java2s;
import java.util.Locale;
import java.util.Map;

public class Main {
    public static final String replaceString(String s,
            Map<String, String> replacement) {
        if (s != null && !s.equals("") && replacement != null) {
            for (String key : replacement.keySet()) {
                String actualKey = "\\{" + key.toUpperCase(Locale.US)
                        + "\\}";
                s = s.replaceAll(actualKey, replacement.get(key));
            }/*from   www  .j  av  a  2 s .  c om*/
        }
        return s;
    }
}

Related

  1. replaceAllKanjiWith(String text, String replacement)
  2. replaceKeyWords(StringBuilder sb, String[] keywords, String replaceStr)
  3. replaceR(String str)
  4. replaceSpace(String str)
  5. replaceStr(String number)
  6. replaceWords(String src, String targetValue, String newValue)
  7. replaceWordsAll(String src, String targetValue, String newValue)
  8. replaceBlank(String str)
  9. replaceBlank(String str)