-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
StringArea → standard library: The `String` typeArea → standard library: The `String` typefeatureA feature request or implementationA feature request or implementationstandard libraryArea: Standard library umbrellaArea: Standard library umbrellaswift evolution implementedFlag → feature: A feature that was approved through the Swift evolution process and implementedFlag → feature: A feature that was approved through the Swift evolution process and implemented
Description
Previous ID | SR-9955 |
Radar | rdar://problem/32340799 |
Original Reporter | @norio-nomura |
Type | New Feature |
Status | Resolved |
Resolution | Done |
Environment
swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-17-a
swift-DEVELOPMENT-SNAPSHOT-2019-02-14-a
Additional Detail from JIRA
Votes | 0 |
Component/s | Standard Library |
Labels | New Feature |
Assignee | @milseman |
Priority | Medium |
md5: 6ba3b0d9475f51dabd794e1b6e524822
Issue Description:
That makes it impossible to write the code below.
extension StringProtocol where Index == String.Index, UTF16View.Index == String.Index {
func toUTF16Indices(_ range: NSRange) -> Range<Index>? {
precondition(range.location != NSNotFound)
guard let start = utf16.index(utf16.startIndex, offsetBy: range.lowerBound, limitedBy: utf16.endIndex),
let end = utf16.index(start, offsetBy: range.length, limitedBy: utf16.endIndex),
let lowerBound = String.Index(start, within: self),
let upperBound = String.Index(end, within: self)
else { return nil }
return Range(uncheckedBounds: (lower: lowerBound, upper: upperBound))
}
}
Metadata
Metadata
Assignees
Labels
StringArea → standard library: The `String` typeArea → standard library: The `String` typefeatureA feature request or implementationA feature request or implementationstandard libraryArea: Standard library umbrellaArea: Standard library umbrellaswift evolution implementedFlag → feature: A feature that was approved through the Swift evolution process and implementedFlag → feature: A feature that was approved through the Swift evolution process and implemented