import java.util.Arrays;
public class Test{
public static void main(String[] args){
String str ="a b c d ef";
String a[]=str.split("\\s{2,}");
System.out.println(Arrays.toString(a));
}
}
[a b, c d, ef]
package com.isoftstone.baidu;
public class DrawDemo {
public static void main(String[] args) {
String str = "a b c d ef";
subStringMethod(str);
}
public static void subStringMethod(String str) {
String[] tempValue = str.split(" ");
for(int i = 0; i < tempValue.length; i++) {
if(!tempValue[i].trim().equals(""))
System.out.print(tempValue[i] + "\t");
}
}
}
substring(0, 3)