code: public static String replaceByMap(String _searchStr, Map<String, String> _replacements) {
          if (_searchStr == null) {
              return null;
          }
          if (_replacements == null || _replacements.isEmpty()) {
              return _searchStr;
          }
  
          String str = _searchStr;
  
          for (Entry<String, String> entry : _replacements.entrySet()) {
              str = str.replace(entry.getKey(), entry.getValue());
          }
  
          return str;
      }
docs: Replace all placeholders in given string by value of the corresponding key in given Map.
  
  @param _searchStr search string
  @param _replacements replacement
  @return String or null if _searchStr was null