You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement unlocalized range(of:) for AttributedString (#249)
* Implement unlocalized range(of:) for AttributedString
`String` has a natively-implemented `_range(of:options:)`. This PR implements `AttributedString`'s `range(of:options:)` with that when localization support is not needed.
Ideally we should implement this on `BigString` to avoid iterating through `Characters`, which is tracked as a future TODO.
This function takes a `Locale` argument, which isn't available in FoundationEssentials. We could move this to FoundationInternalization where `Locale` is defined, but some clients use it with `locale: nil` and do not need localized results. To make the best of this let's add a non-localized version for FoundationEssentials.
* Enable AttributedString.range(of:) when locale is nil
// TODO: Implement localized AttributedStringProtocol.range(of:) for FoundationPreview
245
267
// Since we have secret access to the String property, go ahead and use the full implementation given by Foundation rather than the limited reimplementation we needed for CharacterView.
246
268
// FIXME: There is no longer a `String` property. This is going to be terribly slow.
0 commit comments