public static String last(String list,String delimiter,boolean ignoreEmpty){
  if (StringUtil.isEmpty(list))   return "";
  int len=list.length();
  char[] del;
  if (StringUtil.isEmpty(delimiter)) {
    del=new char[]{','};
  }
 else   del=delimiter.toCharArray();
  int index;
  int x;
  while (true) {
    index=-1;
    for (int i=0; i < del.length; i++) {
      x=list.lastIndexOf(del[i]);
      if (x > index)       index=x;
    }
    if (index == -1) {
      return list;
    }
 else     if (index + 1 == len) {
      if (!ignoreEmpty)       return "";
      list=list.substring(0,len - 1);
      len--;
    }
 else {
      return list.substring(index + 1);
    }
  }
}

public static String last ( String list , String delimiter , boolean ignoreEmpty ) { if ( StringUtil . isEmpty ( list ) ) return "" ; int len = list . length ( ) ; char [ ] del ; if ( StringUtil . isEmpty ( delimiter ) ) { del = new char [ ] { ',' } ; } else del = delimiter . toCharArray ( ) ; int index ; int x ; while ( true ) { index = - 1 ; for ( int i = 0 ; i < del . length ; i ++ ) { x = list . lastIndexOf ( del [ i ] ) ; if ( x > index ) index = x ; } if ( index == - 1 ) { return list ; } else if ( index + 1 == len ) { if ( ! ignoreEmpty ) return "" ; list = list . substring ( 0 , len - 1 ) ; len -- ; } else { return list . substring ( index + 1 ) ; } } }
return last element of the list
