public static String cutSuffix(String string,String suffix){
  if (string.endsWith(suffix)) {
    string=string.substring(0,string.length() - suffix.length());
  }
  return string;
}

public static String cutSuffix ( String string , String suffix ) { if ( string . endsWith ( suffix ) ) { string = string . substring ( 0 , string . length ( ) - suffix . length ( ) ) ; } return string ; }
cuts sufix if exists .
