code: public static String nameOnly(String path)
     {
        int index = path.lastIndexOf('/');
        String name = index == -1 ? path : path.substring(index + 1);
        if (name.endsWith("]"))
        {
           index = name.lastIndexOf('[');
           return index == -1 ? name : name.substring(0, index);
        }
        return name;
     }
docs: Cuts the current name from the path.
  
  @param path path
  @return current name