package Practice_test;

import java.util.Arrays;



public class test {
    public static void main (String[] args) {

	    String res1 = "page=1&size=10&username=code&phone=code&card_no=code&status=1";
	   String sss=getParameter_get(res1,"size");
	   System.out.println(sss);
    }
    
  //在parameter中获取get请求中的参数
  	public static String getParameter_get(String parameter,String Letter){
  		if(parameter==null){
  			return "";
  		}
  		String[] strcomma=parameter.split("&");
  		int comma=strcomma.length;
  		StringBuffer sb=new StringBuffer();
  		for(int k=0;k<comma;k++){
  			String str_strcomma=strcomma[k];
  			if(str_strcomma.contains(Letter)){
  				int start=str_strcomma.indexOf('=');
  				sb.append(str_strcomma.substring(start+1,str_strcomma.length()));
  				return sb.toString();
  			}
  		}
  		return sb.toString();
  	}
}
