code: private static String removeSlashes(String path) {
          String retString = path;
          String slash = System.getProperty("file.separator");
  
          //if non-Unix slashes replace
          retString = retString.replace(slash, "/");
  
          retString = retString.replaceFirst("^/", "");
          retString = retString.replaceFirst("/$", "");
  
          return retString;
      }
docs: Removes leading or trailing slashes from a string.
  
  @param path the string to remove leading or trailing slashes
  @return the string without leading or trailing slashes