String map = "{user=0, name=acba334a0d, arg=2018, userCode=001}"; System.out.println(map); if (map.startsWith("{")) { map = map.substring(1, map.length()); } if (map.endsWith("}")) { map = map.substring(0, map.length() - 1); } Map map1 = new HashMap(16); String[] out = map.split(","); for (String anOut : out) { String[] inn = anOut.split("="); map1.put(inn[0], inn[1]); } System.out.println(map1);
String转map
最新推荐文章于 2024-08-22 02:11:18 发布