instance method unpack_graphemes

Ruby on Rails 6.0.6

Since v4.0.13 Last seen in v6.0.6

Available in: v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6

Signature

unpack_graphemes(string)

Unpack the string at grapheme boundaries. Returns a list of character lists.

Unicode.unpack_graphemes('क्षि') # => [[2325, 2381], [2359], [2367]]
Unicode.unpack_graphemes('Café') # => [[67], [97], [102], [233]]

Parameters

string req
Source
# File activesupport/lib/active_support/multibyte/unicode.rb, line 36
      def unpack_graphemes(string)
        ActiveSupport::Deprecation.warn(<<-MSG.squish)
          ActiveSupport::Multibyte::Unicode#unpack_graphemes is deprecated and will be
          removed from Rails 6.1. Use string.scan(/\X/).map(&:codepoints) instead.
        MSG

        string.scan(/\X/).map(&:codepoints)
      end

Defined in activesupport/lib/active_support/multibyte/unicode.rb line 36 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::Multibyte::Unicode

Type at least 2 characters to search.

↑↓ navigate · open · esc close