import org.apache.commons.lang.StringUtils; public class MainClass { public static void main(String[] args) { //Remove the specified string at the end of String System.out.println("3) Chomp END >>>" + StringUtils.chomp("A test String END", "END")); } }
3) Chomp END >>>A test String