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

转自 :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 ) ;
		  }
		
    }


}

 

posted @ 2017-09-16 21:09  caiqingfei  阅读(341)  评论(0编辑  收藏  举报