method
translate_offset
rails latest stable - Class:
ActiveSupport::Multibyte::Chars
translate_offset(byte_offset)private
No documentation available.
# 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