Details
Description
In version 1.0.1, the method chomp(String) returns a value that is inconsistent
with Perl's function of the same name. Since Perl invented the function chomp,
and since many developers will expect this method to behave the same, we should
bring it in line with expectations.
There are also a cluster of related methods (chopNewline, prechomp, etc.) that
should be renamed/removed/deprecated to match expectations.
Specifically:
Perl:
chop removes the final character, no matter what it is
chomp removes the final character if and only if it's a newline
(or, technically, the $INPUT_RECORD_SEPARATOR).
Current StringUtils:
chop removes the final character, no matter what it is, and glomming
\r\n as if it were a single character
chopNewline removes the final character if and only if it's a newline
(glomming \r\n) – behaving like Perl chomp
chomp removes the last newline and all succeeding characters
(i.e. the last unterminated line)
chompLast removes the last character if and only if it's a newline
(glomming \r\n) – This is redundant with chopNewline, and matches
Perl chomp
getChomp - since Henri's chomp might delete more than just the
separator, this returns the portion that got deleted