1 Map<String, Object> urlSplit(String data){ 2 StringBuffer strbuf = new StringBuffer(); 3 StringBuffer strbuf2 = new StringBuffer(); 4 Map<String ,Object> map = new HashMap<String,Object>(); 5 for(int i =0;i<data.length();i++){ 6 7 if(data.substring(i,i+1).equals("=")){ 8 9 for(int n=i+1;n<data.length();n++){ 10 if(data.substring(n,n+1).equals("&")|| n ==data.length()-1){ 11 map.put(strbuf.toString(), strbuf2); 12 strbuf =new StringBuffer(""); 13 strbuf2 =new StringBuffer(""); 14 i=n; 15 break; 16 } 17 strbuf2.append(data.substring(n,n+1)); 18 } 19 continue; 20 } 21 strbuf.append(data.substring(i,i+1)); 22 } 23 24 return map; 25 }
java截取url中的值
最新推荐文章于 2024-06-29 03:18:42 发布