method

each_grapheme_cluster

Importance_1
v2_6_3 - Show latest stable - 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.