mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[DOC] Tweaks for String#chomp
This commit is contained in:
parent
f17e5c4d5a
commit
1de0b28cbb
1 changed files with 5 additions and 2 deletions
|
@ -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].
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue