Ruby/String/chop
Материал из Wiki.crossplatform.ru
Call shop function from string class
" Test ".chop
chop removes the last character (a quote) with abandon
joe = "Joe joe" puts joe.chop!
chop removes trailing character or line terminator (\n, \r, or \r\n)
s = "hello\n" s.chop! # => "hello": line terminator removed. s modified. s.chop # => "hell": last character removed. s not modified. "".chop # => "": no characters to remove "".chop! # => nil: nothing changed