code: public static String removeIndexFromPath(String path)
     {
        if (path.endsWith("]"))
        {
           int index = path.lastIndexOf('[');
           if (index != -1)
           {
              return path.substring(0, index);
           }
        }
        return path;
     }
docs: Removes the index from the path if it has an index defined