code: public static String stripTrailingSlash(String s) {
      return s == null ? null : CharMatcher.is('/').trimTrailingFrom(s);
    }
docs: Strips the trailing slash from a string if it has a trailing slash; otherwise return the
  string unchanged.