提取json字符串中指定格式中的参数值
直接上代码:
import java.util.ArrayList;
import Matcher;
import Pattern;
smokingisharmfulpublic class TestDemo {
public static void main(String[] args) {
ArrayList json = new ArrayList();
json.add("111");
json.add("222");
json.add("333");
Ur ur = new Ur();
ur.tJson(json);
ur.tCode("200");
ur.tMessage("true");
String string = "(" + JSONString(ur) + ")";
System.out.println(string);
豌豆的英文
// String regex = "\"json\":(.*?),\"message\"";// 使⽤⾮贪婪模式!
Pattern pattern = pile("\\[\"(.*?)\"\\]");
Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.up(1));
}
String par = "[{CSTM_NO:\"11118\",CSTM_NAME:\"⼴东XX电⼒有限公司\",FIX_GNL:\"111810158\",FIX_ACC:\"D201306070003\"," + "OP_FLAG:\"正常\",BUSS_KIND_NAME:\"三个⽉定期存款\",BAL:\"25,178,750.00\",AVAL_BAL:\"25,178,750.00\"," +
"OP_DATE:\"2013-06-07\",DUE_DATE:\"2013-12-07\",ROWNUM_:1,idx:0},{CSTM_NO:\"11118\"," +
"CSTM_NAME:\"⼴东XX电⼒有限公司\",FIX_GNL:\"111810158\",FIX_ACC:\"D201306070002\",OP_FLAG:\"正常\"," +
"BUSS_KIND_NAME:\"三个⽉定期存款\",BAL:\"25,178,750.00\",AVAL_BAL:\"25,178,750.00\",OP_DATE:\"2013-06-07\"," +
"DUE_DATE:\"2013-12-07\",ROWNUM_:3,idx:2},{CSTM_NO:\"11118\",CSTM_NAME:\"⼴东XX电⼒有限公司\"," +
"FIX_GNL:\"111810158\",FIX_ACC:\"D201306070005\",OP_FLAG:\"正常\",BUSS_KIND_NAME:\"三个⽉定期存款\"," +
在线反译"BAL:\"25,178,750.00\",AVAL_BAL:\"25,178,750.00\",OP_DATE:\"2013-06-07\",DUE_DATE:\"2013-12-07\"," +
美术考研培训班"ROWNUM_:4,idx:3}]";
String regex = "FIX_ACC:(.*?),OP_FLAG";//别忘了使⽤⾮贪婪模式!
Matcher matcher1 = pile(regex).matcher(par);
while (matcher1.find()) {
String ret = up(1);
System.out.println(ret);
}
String str = "我是[001]真⼼求救的[002],你能帮帮我吗";
Pattern pattern1 = pile("\\[(.*?)\\]");
网上学习英语Matcher matcher2 = pattern1.matcher(str);
while(matcher2.find()){
友善的交谈
System.out.up(1));
}
}布宜诺斯艾利斯大学
}
不客气英语怎么说打印结果如下:
({"code":"200","json":["111","222","333"],"message":"true"})
111","222","333
"D201306070003"
upt是什么意思"D201306070002"
"D201306070005"
001
systema002
Process finished with exit code 0