"David A. Black" <dblack / wobblini.net> writes:

> String#chop chops off the rightmost character:
>
>    irb(main):001:0> "abc".chop
>    => "ab"

Except if the string ends with a CRLF pair:

   "abc\r\n".chop  #=> "abc"

> You may be thinking of "chomp", which is a specialized "chop"
> operating only on newline characters.

If you read the docstrings, you get the impression that String#chop
is more-or-less deprecated in favor of the ``safer'' String#chomp:

   +String#chomp+ is ofter a safer alternative, as it leaves
   the string unchanged if it doesn't end in a record separator.

> So the idea of lchop would be to serve as a left-hand equivalent
> of chop.

So I suppose if the string starts with a CRLF pair, String#lchop would
chop off two characters from the left?

Why not go all the way and let all string methods treat CRLF pairs as
single characters?

I think it's a problem that strings are the only way to go for raw
byte arrays in Ruby, yet

  * strings lack a few random useful array methods

  * the string methods are not binary safe.

-- 
Daniel Brockman <daniel / brockman.se>