map.toString back to String

In the original blog: https://blog.csdn.net/zhpeng289/article/details/83780445

I changed a bit on the basis of: 

The idea is: Get the key and value, direct deposit map

private static Map<String, String> mapStringToMap(String str) {
		str = str.substring(1, str.length() - 1);
		String[] strs = str.split(",");
		Map<String, String> map = new HashMap<String, String>();
		for (String string : strs) {
			String key = string.split("=")[0];
			String value = string.substring(string.indexOf("=") + 1);
			map.put(key.trim(), value.trim());
		}
		return map;
	}

 

Guess you like

Origin blog.csdn.net/luo_yu_1106/article/details/90704010