public static void main(String[] args) { String str="&emailCheckURL=447&[email protected]&porm=p"; String[] splitURL=str.split("&"); Map<String,Object> mapParam=new HashMap<String,Object>(); for(String s:splitURL){ if(s.indexOf("=")>0){ mapParam.put(s.substring(0, s.indexOf("=")),s.substring(s.indexOf("=")+1, s.length())); } } for(Map.Entry<String, Object> entry:mapParam.entrySet()){ System.out.println(entry.getKey()+"~~~"+entry.getValue()); } }
时间: 2024-10-06 19:56:24