code: public static String asPrefix(String s) {
          // Strip last path-segment, if more than 3 slashes
          s = s.replaceAll("^(.*//.*/)[^/]*","$1");
          // Strip trailing ")", if present and NO path (no 3rd slash).
          if (!s.endsWith("/")) {
              s = s.replaceAll("^(.*)\\)","$1");
          }
          return s;
      }
docs: Utility method for truncating a SURT that came from a
  full URI (as a seed, for example) into a prefix
  for determining inclusion.
  
  This involves:
  <pre>
  (1) removing the last path component, if any
  (anything after the last '/', if there are
  at least 3 '/'s)
  (2) removing a trailing ')', if present, opening
  the possibility of proper subdomains. (This
  means that the presence or absence of a
  trailing '/' after a hostname in a seed list
  is significant for the how the SURT prefix is
  created, even though it is not signficant for
  the URI's treatment as a seed.)
  </pre>
  
  @param s String to work on.
  @return As prefix.