commit | ee745fef4ee71dab411a89b63fe67f4caba56ea4 | [log] [tgz] |
---|---|---|
author | Lasse R.H. Nielsen <lrn@google.com> | Fri Nov 15 13:37:58 2019 +0100 |
committer | GitHub <noreply@github.com> | Fri Nov 15 13:37:58 2019 +0100 |
tree | 59710de29a2ec810fa6cdc21e0643d9c3e7dd008 | |
parent | 4c6cc843f914f79b249cee9aa7b51d32772f5016 [diff] |
Hide UTF-16 assumptions in the API. (#13) * Avoid the API depending on the underlying data being random-access UTF-16 code units. In this case, don't return `codeUnits` as a list of integers, but explicitly say `utf16CodeUnits` and return them as an iterable. That can be implemented as efficiently as possible on, say, a UTF-8 byte array. * Also use .characters in rest of example.
NOTE: This package is considered experimental, and breaking API changes are to be expected.
Characters
are strings viewed as sequences of user-perceived characters, also know as Unicode (extended) grapheme clusters.
The Characters
class allows access to the individual characters of a string, and a way to navigate back and forth between them using a CharacterRange
.