JuliaLang/julia — pull request #9261 by stevengj (2014-12-07 02:36:28+00:00)
Title: add graphemes(s) function to iterate over string graphemes

utf8proc/libmojibake includes a feature to break a string up into [graphemes (as defined by UAX#29)](http://www.unicode.org/reports/tr29/). This PR exports a new function `graphemes(s::AbstractString)` to expose this functionality as an iterator over substrings of `s`.

e.g. `collect(graphemes("b̀lahβlahb̂láh"))` yields `SubString{UTF8String}["b̀","l","a","h","β","l","a","h","b̂","l","á","h"]`. Note that these are strings, not characters, because graphemes may consist of multiple codepoints (e.g. `"b̀"` is `"\u0062\u0300"` in any normalization).

(This may be useful e.g. in the REPL if we want the arrow keys etcetera to work with graphemes as recommended by UAX#29.)

cc: @jiahao, @Keno