method

each_grapheme_cluster

Importance_1
Ruby latest stable (v2_5_5) - 0 notes - Class: String
each_grapheme_cluster() public

Passes each grapheme cluster in str to the given block, or returns an enumerator if no block is given. Unlike String#each_char, this enumerates by grapheme clusters defined by Unicode Standard Annex #29 http://unicode.org/reports/tr29/

"a\u0300".each_char.to_a.size #=> 2
"a\u0300".each_grapheme_cluster.to_a.size #=> 1
Show source
Register or log in to add new notes.