code: public static String removeSuffix(String filename, String suffix) {
      if (filename.endsWith(suffix)) {
        return filename.substring(0, filename.length() - suffix.length());
      }
      return filename;
    }
docs: Removes a suffix from a filename, if it has it.
  @param filename the filename to strip
  @param suffix the suffix to remove
  @return the shortened filename