public class Split {
public static void main(String[] args) {
splitDemo("ffaslfhhhhfossfu","(.)\\1+");
}
public static void splitDemo(String str,String reg)
{
String[] arr=str.split(reg);
System.out.println(arr.length);
for(String s:arr)
{
System.out.println(s);
}
}
}
运行结果第一行是空的,怎么控制呢? |