chop() public

Equivalent to ($_.dup).chop!, except nil is never returned. See String#chop!.

a  =  "now\r\n"
$_ = a
chop   #=> "now"
$_     #=> "now"
chop   #=> "no"
chop   #=> "n"
chop   #=> ""
chop   #=> ""
a      #=> "now\r\n"
Show source
Register or log in to add new notes.