public static ArrayList SearchName(String name, ArrayList first, ArrayList last) { ArrayList flist = new ArrayList(); ArrayList llist = new ArrayList(); ArrayList rlist = new ArrayList(); if ((name == null) || (first == null) || (last == null)) return (initList(rlist,"0")); String fs = null, ls = null, ns; int pos,len; boolean both = false; ns = name.trim(); pos = ns.indexOf(","); len = ns.length(); if ((pos > 0) && (pos+1 < len)) { both = true; ls = ns.substring(0, pos).trim(); fs = ns.substring(pos+1).trim(); }else if (pos > 0) { ls = ns.substring(0, pos).trim(); fs = ls; } if ((fs == null) && (ls == null)) { pos = ns.indexOf(" "); if ((pos >0) && (pos + 1 < len)) { if (!both) both = true; fs = ns.substring(0, pos).trim(); ls = ns.substring(pos+1).trim(); }else{ ls = ns; fs = ns; } } if (fs == null) fs = ls; if (ls == null) ls = fs; flist = SearchString(fs, first); llist = SearchString(ls, last); Iterator itf = flist.iterator(); Iterator itl = llist.iterator(); if (both) { while (itf.hasNext()) { String itfs = (String)itf.next(); String itls = (String)itl.next(); if ((itfs.equalsIgnoreCase("1")) && (itls.equalsIgnoreCase("1"))) { rlist.add("1"); } else { rlist.add("0"); } } } else { while (itf.hasNext()) { String itfs = (String)itf.next(); String itls = (String)itl.next(); if ((itfs.equalsIgnoreCase("1")) || (itls.equalsIgnoreCase("1"))) { rlist.add("1"); } else { rlist.add("0"); } } } return rlist; }