List of utility methods to do String Chomp
String | chompHeader(String str, String prex) chomp Header if (str == null) { return ""; if (str.startsWith(prex)) { return str.substring(prex.length()); return str; |
String | chompLast(String str) chomp Last return chompLast(str, "\n"); |
String | chompLast(String str, String sep) Remove a value if and only if the String ends with that value. if (str.length() == 0) { return str; String sub = str.substring(str.length() - sep.length()); if (sep.equals(sub)) { return str.substring(0, str.length() - sep.length()); return str; ... |
String | chompNewLine(String line) chomp New Line return line.replaceAll("(\r|\n\r?)$", ""); |