public static String cutSurrounding(String string,String prefix,String suffix){
  int start=0;
  int end=string.length();
  if (string.startsWith(prefix)) {
    start=prefix.length();
  }
  if (string.endsWith(suffix)) {
    end-=suffix.length();
  }
  return string.substring(start,end);
}

public static String cutSurrounding ( String string , String prefix , String suffix ) { int start = 0 ; int end = string . length ( ) ; if ( string . startsWith ( prefix ) ) { start = prefix . length ( ) ; } if ( string . endsWith ( suffix ) ) { end -= suffix . length ( ) ; } return string . substring ( start , end ) ; }
removes surrounding prefix and suffixes .
