instance method
translate_offset
Ruby on Rails 5.2.8.1
Since v5.2.8.1 Last seen in v5.2.8.1 PrivateSignature
translate_offset(byte_offset)
No documentation comment.
Parameters
-
byte_offsetreq
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 218
def translate_offset(byte_offset)
return nil if byte_offset.nil?
return 0 if @wrapped_string == ""
begin
@wrapped_string.byteslice(0...byte_offset).unpack("U*").length
rescue ArgumentError
byte_offset -= 1
retry
end
end
Defined in activesupport/lib/active_support/multibyte/chars.rb line 218
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Chars