My goal: given an arbitrary UTF-16 position in a String
, find the corresponding String.Index
that represents the Character
(i.e. the extended grapheme cluster) the specified UTF-16 code unit is a part of.
Example:
(I put the code in a Gist for easy copying and pasting.)
This is my test string:
let str = "