一個取串的問題!有點急!
String s= "S801145/S124/S87115/S11/S45963/S110 ";
怎么以 "/ "為標志﹐把前三個 "S801145/S124/S87115 "和后三個 "S11/S45963/S110 "
分開。菜鳥問題不知道怎么做?
------解决方案--------------------先分成6个再三三组合
------解决方案--------------------string [] a = s.spilt( "/ ");
------解决方案-------------------- String s= "S801145/S124/S87115/S11/S45963/S110 ";
String v1=null,v2=null;
Pattern pt = Pattern.compile( "^(.*?/.*?/.*?)/(.*)$ ");
Matcher mc = pt.matcher(s);
if(mc.find()){
//System.out.println(mc.group(1));
v1 = mc.group(1);
v2 = mc.group(2);
}
System.out.println(v1+ "\n "+v2);
------解决方案--------------------String[] ss = s.split( "(? <=.+/.+/.+)/(?=.+/.+/.+) ");
------解决方案--------------------借宝地请教一下老大们。
String str = "iddddi_idfddi_iffffi ";
用一个正则表达式怎么分成dddd,dfdd,ffff呀