public static String[] arraySplit(String s,char separatorChar,boolean trim){
  if (s == null) {
    return null;
  }
  int length=s.length();
  if (length == 0) {
    return new String[0];
  }
  ArrayList<String> list=New.arrayList();
  StringBuilder buff=new StringBuilder(length);
  for (int i=0; i < length; i++) {
    char c=s.charAt(i);
    if (c == separatorChar) {
      String e=buff.toString();
      list.add(trim ? e.trim() : e);
      buff.setLength(0);
    }
 else     if (c == '\\' && i < length - 1) {
      buff.append(s.charAt(++i));
    }
 else {
      buff.append(c);
    }
  }
  String e=buff.toString();
  list.add(trim ? e.trim() : e);
  String[] array=new String[list.size()];
  list.toArray(array);
  return array;
}

public static String [ ] arraySplit ( String s , char separatorChar , boolean trim ) { if ( s == null ) { return null ; } int length = s . length ( ) ; if ( length == 0 ) { return new String [ 0 ] ; } ArrayList < String > list = New . arrayList ( ) ; StringBuilder buff = new StringBuilder ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { char c = s . charAt ( i ) ; if ( c == separatorChar ) { String e = buff . toString ( ) ; list . add ( trim ? e . trim ( ) : e ) ; buff . setLength ( 0 ) ; } else if ( c == '\\' && i < length - 1 ) { buff . append ( s . charAt ( ++ i ) ) ; } else { buff . append ( c ) ; } } String e = buff . toString ( ) ; list . add ( trim ? e . trim ( ) : e ) ; String [ ] array = new String [ list . size ( ) ] ; list . toArray ( array ) ; return array ; }
split a string into an array of strings using the given separator . a null string will result in a null array , and an empty string in a zero element array .
