method

chop

v1_8_7_330 - Show latest stable - Class: Kernel
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"