Skip to content
instance method

String#chop!

() -> self?
chop! → self or nil

Like String#chop, except that:

  • Removes trailing characters from self (not from a copy of self).

  • Returns self if any characters are removed, nil otherwise.

Related: see Modifying.

See also #chop #chr #chomp! #clear also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0