docs: protected static String removeExtension(String str, String ext) {
          if (!str.endsWith(ext)) {
              return str;
          }
          int index = str.lastIndexOf(ext);
          index = index <= 0 ? 1 : index;
          str = str.substring(0, index - 1);
          return str;
      }