解决方案 »
- 一个网站需要注册码,想知道它的原理?
- MAVEN 部署 ,TOMCAT 配置
- SSH不能连接上数据库问题,求高手解答!!!
- C#调用java写的webservice上传附件
- 急!急!急!求邮件发送的程序,要求用STRUTS来实现!!
- 怎么样在对象变量中加参数?
- 请问j2ee的学习主要要掌握那些方面的东西啊
- 提个小问题,hashcode && equals
- Servlet在访问的时侯IE显示Forbidden
- j2ee连oracle数据库?
- jsp问题: The server encountered an internal error () that prevented it from fulfil
- 【求助】求大神教我写一个SQL语句,在线急等!!!!
List<String> sIdList = new ArrayList<String>();
List<String> gIdList = new ArrayList<String>();
for(var i=0;i<temp.length;i++){
String[] temp1=temp[i].split("*");
sIdList.add(temp1[0]);
gIdList.add(temp1[1]);
}
//两个集合成对出现,不用客气。你到问题描述的不是十分清楚哦
sId*gId_gId_gId_gId,
sId*gId
..........
"
例如 10000*1_2,
10001*3_4_5_6,
10002*7,
......................截取后的是 sid gid
String demo = "sId1*gId1_gId2,sId2*gId1";
String[] splitedSid = demo.split(",");
Map<String, String[]> map = new HashMap<String, String[]>();
for (int i = 0; i < splitedSid.length; i++) {
String gid = splitedSid[i].split("\\*")[0];
String[] splitedGid = splitedSid[i].split("\\*")[1].split("_");
map.put(gid, splitedGid);
}
Matcher m = Pattern.compile("(.*?),").matcher(s);
while(m.find()){
System.out.println(m.group(1).split("\\*")[0]+"--->"+m.group(1).split("\\*")[1]);
}