String转map

【String转map】临文乍了了,彻卷兀若无。这篇文章主要讲述String转map相关的知识,希望能为你提供帮助。

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);




    推荐阅读