public static String last(String list,char delimiter){
  int len=list.length();
  if (len == 0)   return "";
  int index=0;
  while (true) {
    index=list.lastIndexOf(delimiter);
    if (index == -1) {
      return list;
    }
 else     if (index + 1 == len) {
      list=list.substring(0,len - 1);
      len--;
    }
 else {
      return list.substring(index + 1);
    }
  }
}

public static String last ( String list , char delimiter ) { int len = list . length ( ) ; if ( len == 0 ) return "" ; int index = 0 ; while ( true ) { index = list . lastIndexOf ( delimiter ) ; if ( index == - 1 ) { return list ; } else if ( index + 1 == len ) { list = list . substring ( 0 , len - 1 ) ; len -- ; } else { return list . substring ( index + 1 ) ; } } }
return last element of the list
