method

translate_offset

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: ActiveSupport::Multibyte::Chars

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v5.2.3) is shown here.

translate_offset(byte_offset) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide 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
Register or log in to add new notes.