[5.8][stdlib] Export grapheme breaking facility #62863
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-picked from #62794.
Unicode._CharacterRecognizer
is a newly exported opaque type that exposes the stdlib’s extended grapheme cluster breaking facility, independent ofString
.This essentially makes the underlying simple state machine public, without exposing any of the (unstable) Unicode details.
The ability to perform grapheme breaking over, say, the scalars stored in multiple
String
values can be extremely useful while building custom text processing algorithms and data structures.Ideally this would eventually become API, but before proposing this to Swift Evolution, I’d like to prove the shape of the type in actual use (and we’ll also need to find better names for its operations).
rdar://103903565