public static Array listWithQuotesToArray(String list,String delimiter,String quotes){
  if (list.length() == 0)   return new ArrayImpl();
  int len=list.length();
  int last=0;
  char[] del=delimiter.toCharArray();
  char[] quo=quotes.toCharArray();
  char c;
  char inside=0;
  ArrayImpl array=new ArrayImpl();
  try {
    for (int i=0; i < len; i++) {
      c=list.charAt(i);
      for (int y=0; y < quo.length; y++) {
        if (c == quo[y]) {
          if (c == inside)           inside=0;
 else           if (inside == 0)           inside=c;
          continue;
        }
      }
      for (int y=0; y < del.length; y++) {
        if (inside == 0 && c == del[y]) {
          array._append(list.substring(last,i));
          last=i + 1;
          break;
        }
      }
    }
    if (last <= len)     array.append(list.substring(last));
  }
 catch (  ExpressionException e) {
  }
  return array;
}

public static Array listWithQuotesToArray ( String list , String delimiter , String quotes ) { if ( list . length ( ) == 0 ) return new ArrayImpl ( ) ; int len = list . length ( ) ; int last = 0 ; char [ ] del = delimiter . toCharArray ( ) ; char [ ] quo = quotes . toCharArray ( ) ; char c ; char inside = 0 ; ArrayImpl array = new ArrayImpl ( ) ; try { for ( int i = 0 ; i < len ; i ++ ) { c = list . charAt ( i ) ; for ( int y = 0 ; y < quo . length ; y ++ ) { if ( c == quo [ y ] ) { if ( c == inside ) inside = 0 ; else if ( inside == 0 ) inside = c ; continue ; } } for ( int y = 0 ; y < del . length ; y ++ ) { if ( inside == 0 && c == del [ y ] ) { array . _append ( list . substring ( last , i ) ) ; last = i + 1 ; break ; } } } if ( last <= len ) array . append ( list . substring ( last ) ) ; } catch ( ExpressionException e ) { } return array ; }
casts a list to array object , the list can be have quoted ( " , ' ) arguments and delimter in this arguments are ignored . quotes are not removed example : listwithquotestoarray ( " aab , a ' a , b ' , a \ " a , b \ " " , " , " , " \ " ' " ) will be translated to [ " aab " , " a ' a , b ' " , " a \ " a , b \ " " ]
