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