code: static CharSequence chomp(CharSequence cs) {
          if (cs != null) {
              final int len = cs.length();
              if (len > 1 && cs.charAt(len - 2) == '\r' && cs.charAt(len - 1) == '\n') {
                  return cs.subSequence(0, len - 2);
              } else if (len > 0 && cs.charAt(len - 1) == '\n') {
                  return cs.subSequence(0, len - 1);
              }
          }
          return cs;
      }
docs: "chomp" as in Perl or https://commons.apache.org/proper/commons-lang/apidocs/org/apache/commons/lang3/StringUtils.html#chomp-java.lang.String-