字符串匹配,拆分(空白字符)

转自 :http://www.cnblogs.com/fsjohnhuang/p/4098623.html

package regex;

public class GetSingleString 
{
	public static void main(String[] args) 
	{
		
		String s="aaaa bbbb cccc";
                String[] split = s.split("\s+");
		System.out.println(split.length);
		  for(String each : split )
		  {
			  System.out.println( each ) ;
		  }
		
    }


}

 

原文地址:https://www.cnblogs.com/rrttp/p/7532924.html