code: public static String stripLastSlash(String inputString) {
          if (null == inputString) {
              return null;
          }
          String rc = inputString.trim();
          int len = rc.length();
          if (0 < len) {
              char lastChar = rc.charAt(len - 1);
              if ('/' == lastChar || '\\' == lastChar) {
                  rc = rc.substring(0, len - 1);
              }
          }
  
          return rc;
      }
docs: Remove the last slash, if present, from the input string and return the
  result.
  
  @param inputString
  @return String