借鉴代码
public class StringToMapUtil { public static Map<String, String> getValue(String param) { Map map = new HashMap(); String str = ""; String key = ""; Object value = ""; char[] charList = param.toCharArray(); boolean valueBegin = false; for (int i = 0; i < charList.length; i++) { char c = charList[i]; if (c == '{') { if (valueBegin == true) { value = getValue(param.substring(i, param.length())); i = param.indexOf('}', i) + 1; map.put(key, value); } } else if (c == '=') { valueBegin = true; key = str; str = ""; } else if (c == ',') { valueBegin = false; value = str; str = ""; map.put(key, value); } else if (c == '}') { if (str != "") { value = str; } map.put(key, value); return map; } else if (c != ' ') { str += c; } } return map; } }