public static String trimLeadingAndTrailingSlashes(final String in){
  if (null == in)   return in;
  String out=in;
  if (out.startsWith("/")) {
    out=out.substring(1);
  }
  if (out.endsWith("/")) {
    out=out.substring(0,out.length() - 1);
  }
  return out;
}

public static String trimLeadingAndTrailingSlashes ( final String in ) { if ( null == in ) return in ; String out = in ; if ( out . startsWith ( "/" ) ) { out = out . substring ( 1 ) ; } if ( out . endsWith ( "/" ) ) { out = out . substring ( 0 , out . length ( ) - 1 ) ; } return out ; }
utility method for trimming and leading and / or trailing slashes from its input . may return the empty string . may return null if and only if the input is null .
