代码如下:
使用正则表达式分别取出“type:a;”和“type:b;”。public class Test { public static void main(String[] args){
String path = "type: a; path: b;";
Pattern c = Pattern.compile(".*;");
Matcher matcher = c.matcher(path);
while(matcher.find()){
System.out.println(matcher.group());
}
}
}
使用正则表达式分别取出“type:a;”和“type:b;”。public class Test { public static void main(String[] args){
String path = "type: a; path: b;";
Pattern c = Pattern.compile(".*;");
Matcher matcher = c.matcher(path);
while(matcher.find()){
System.out.println(matcher.group());
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货