icu4x
icu4x copied to clipboard
Add methods to iterate exemplar characters
Adds public code_point_ranges and strings methods to ExemplarCharacters to allow iterating through the single- and multi-character entries, respectively:
code_point_rangesreturns aCodePointRangeIterator(existing struct)stringsreturns aStringIterator, a new struct that iterates via passing aDiplomatWritebuffer to itsnextmethod, writing a null-char-terminated string forSome(string)and an empty string forNone(thus differentiatingSome("") -> "\0"fromNone -> "", though in practiceSome("")should never occur for exemplar chars). Not sure if there's a better way of iterating strings across the FFI boundary.
Thus for hu locale and Main set:
# `code_point_ranges`
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 't', 'u', 'v', 'z', 'á', 'é', 'í', 'ó', 'ö', 'ú', 'ü', 'ő', 'ű'
# `strings`
"ccs", "cs", "ddz", "ddzs", "dz", "dzs", "ggy", "gy", "lly", "ly", "nny", "ny", "ssz", "sz", "tty", "ty", "zs", "zzs"
I also added a tab to the WASM demo to illustrate how these can be used from JS/TS.
Hi @lionel-rowe, do you plan to address @Manishearth's feedback?
@sffc Sorry for delayed reply, I had a go at fixing the issues but TBH my Rust knowledge is lacking. I might have another crack at it later but not sure when I'll have time.
Ignore the CLA assistant if you already signed it. It's buggy right now, we'll let you know when you can sign if you haven't signed already
Ignore the CLA assistant if you already signed it. It's buggy right now, we'll let you know when you can sign if you haven't signed already
Fixed