[DOC] Tweaks for String#chomp

This commit is contained in:
BurdetteLamar 2025-07-08 12:40:09 -05:00 committed by Peter Zhu
parent f17e5c4d5a
commit 1de0b28cbb

View file

@ -25,5 +25,8 @@ removes multiple trailing occurrences of <tt>"\n"</tt> or <tt>"\r\n"</tt>
When +line_sep+ is neither <tt>"\n"</tt> nor <tt>''</tt>,
removes a single trailing line separator if there is one:
'abcd'.chomp('d') # => "abc"
'abcdd'.chomp('d') # => "abcd"
'abcd'.chomp('cd') # => "ab"
'abcdcd'.chomp('cd') # => "abcd"
'abcd'.chomp('xx') # => "abcd"
Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].