您的位置:首页 > 其它

get方式数据获取

2016-02-17 15:27 363 查看
package com.charge.util;

import java.util.HashMap;

public class ResUtils {

public static String getFromRes(String res, String fldName) {

if(res == null || fldName == null) {

return "";

}

String[] arr = res.split("&");

for(int i=0; i<arr.length; i++) {

String t = arr[i];

String[] tt = t.split("=");

if(fldName.equalsIgnoreCase(tt[0])) {

return tt[1];

}

}

return "";

}

/**

* @param args

*/

public static void main(String[] args) {

// TODO Auto-generated method stub

String res = "mer_id=*****&rtn_code=*****&rtn_msg=无效&sign_abs=e5ff3e36f7e193627d6ab217872c60b8";

System.out.println("merId:"+getFromRes(res, "mer_id"));

System.out.println("rtn_code:"+getFromRes(res, "rtn_code"));

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: