public static int len(String list,String delimiter,boolean ignoreEmpty){
  if (delimiter.length() == 1)   return len(list,delimiter.charAt(0),ignoreEmpty);
  char[] del=delimiter.toCharArray();
  int len=StringUtil.length(list);
  if (len == 0)   return 0;
  int count=0;
  int last=0;
  char c;
  for (int i=0; i < len; i++) {
    c=list.charAt(i);
    for (int y=0; y < del.length; y++) {
      if (c == del[y]) {
        if (!ignoreEmpty || last < i)         count++;
        last=i + 1;
        break;
      }
    }
  }
  if (!ignoreEmpty || last < len)   count++;
  return count;
}

public static int len ( String list , String delimiter , boolean ignoreEmpty ) { if ( delimiter . length ( ) == 1 ) return len ( list , delimiter . charAt ( 0 ) , ignoreEmpty ) ; char [ ] del = delimiter . toCharArray ( ) ; int len = StringUtil . length ( list ) ; if ( len == 0 ) return 0 ; int count = 0 ; int last = 0 ; char c ; for ( int i = 0 ; i < len ; i ++ ) { c = list . charAt ( i ) ; for ( int y = 0 ; y < del . length ; y ++ ) { if ( c == del [ y ] ) { if ( ! ignoreEmpty || last < i ) count ++ ; last = i + 1 ; break ; } } } if ( ! ignoreEmpty || last < len ) count ++ ; return count ; }
returns count of items in the list
