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"));
}
}
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"));
}
}
相关文章推荐
- systemctl命令完全指南
- 根据传入url请求,返回json字符串
- 基于linux的ekho(余音)安装与开发
- Oracle 中的 TO_DATE 和 TO_CHAR 函数
- iOS 使用SDwebImage缓存图片并在断网时候显示
- DialogFragment设置不可取消
- 面试题答案整理
- unbuntu 下的vim的使用和编译
- hibernate4之 配置(一)
- 将后台返回的 json 对象快速填充到表单
- Tomcat部署Web应用方法总结
- 此证书的签发者无效
- linux 查找目录下文本内容字符串
- UWP 应用获取各类系统、用户信息 (2) - 商店授权信息、零售演示模式信息、广告 ID、EAS 设备信息、硬件识别信息、移动网络信息
- Xcode的command+shift+o是一个不错的工具
- SQL 大数据查询如何进行优化?
- (转)关于yuv 格式:planar和semi-planar格式
- 使用Java的BlockingQueue实现生产者-消费者
- Xcode 报错No matching provisioning profiles found 解决方案
- SQL中distinct的用法