String str = "hello world\n"; String chompedStr = StringUtils.chomp(str, "\n"); System.out.println(chompedStr);
String str = "foo-bar-"; String chompedStr = StringUtils.chomp(str, "-"); System.out.println(chompedStr);
import org.apache.commons.lang.StringUtils;This tells us that the StringUtils class is part of the org.apache.commons.lang package library.