pineapple丿夜曲

导航

字符串分割

  1.   System.out.println(":ab:cd:ef::".split(":").length);//末尾分隔符全部忽略    
  2.   System.out.println(":ab:cd:ef::".split(":",-1).length);//不忽略任何一个分隔符    
  3.   System.out.println(StringUtils.split(":ab:cd:ef::",":").length);//最前面的和末尾的分隔符全部都忽略,apache commons    
  4.   System.out.println(StringUtils.splitPreserveAllTokens(":ab:cd:ef::",":").length);//不忽略任何一个分隔符 apache commons 

posted on 2017-12-13 19:42  pineapple丿夜曲  阅读(92)  评论(0编辑  收藏  举报