instance method
grapheme_length
Ruby on Rails 6.0.6
Since v4.0.13Signature
grapheme_length()
Returns the number of grapheme clusters in the string.
'क्षि'.mb_chars.length # => 4 'क्षि'.mb_chars.grapheme_length # => 3
Source
# File activesupport/lib/active_support/multibyte/chars.rb, line 185
def grapheme_length
@wrapped_string.scan(/\X/).length
end
Defined in activesupport/lib/active_support/multibyte/chars.rb line 185
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::Multibyte::Chars