instance method
slice!
Ruby on Rails 2.3.18
Since v2.3.18Signature
slice!(*args)
Like String#slice!, except instead of byte offsets you specify character offsets.
Example:
s = 'こんにちは' s.mb_chars.slice!(2..3).to_s #=> "にち" s #=> "こんは"
Parameters
-
argsrest
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 359
def slice!(*args)
slice = self[*args]
self[*args] = ''
slice
end
Defined in activesupport/lib/active_support/multibyte/chars.rb line 359
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Chars