public static String trimPath(final String url) {
    for (int i = 0; i < url.length(); i++) {
      switch (url.charAt(i)) {
        case '?', '#' -> {
          return url.substring(0, i);
        }
      }
    }
    return url;
  }
public static String trimPath(final String url)