mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[DOC] Tweaks for String#delete_suffix
This commit is contained in:
parent
55dd2022fd
commit
07a3ab53a2
1 changed files with 7 additions and 4 deletions
|
@ -1,8 +1,11 @@
|
|||
Returns a copy of +self+ with trailing substring <tt>suffix</tt> removed:
|
||||
|
||||
'hello'.delete_suffix('llo') # => "he"
|
||||
'hello'.delete_suffix('hel') # => "hello"
|
||||
'тест'.delete_suffix('ст') # => "те"
|
||||
'foo'.delete_suffix('o') # => "fo"
|
||||
'foo'.delete_suffix('oo') # => "f"
|
||||
'foo'.delete_suffix('foo') # => ""
|
||||
'foo'.delete_suffix('f') # => "foo"
|
||||
'foo'.delete_suffix('x') # => "foo"
|
||||
'тест'.delete_suffix('ст') # => "те"
|
||||
'こんにちは'.delete_suffix('ちは') # => "こんに"
|
||||
|
||||
Related: String#delete_suffix!, String#delete_prefix.
|
||||
Related: see {Converting to New String}[rdoc-ref:String@Converting+to+New+String].
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue