[stdlib] Rename index(...) methods to firstIndex(...)

A la SE-204.
This commit is contained in:
Nate Cook
2017-10-19 11:05:48 -05:00
parent 67852ed460
commit 58933d88c5
45 changed files with 200 additions and 175 deletions

View File

@@ -390,7 +390,7 @@ extension String {
/// another string's `utf8` view.
///
/// let picnicGuest = "Deserving porcupine"
/// if let i = picnicGuest.utf8.index(of: 32) {
/// if let i = picnicGuest.utf8.firstIndex(of: 32) {
/// let adjective = String(picnicGuest.utf8[..<i])
/// print(adjective)
/// }
@@ -583,7 +583,7 @@ extension String.UTF8View.Index {
///
/// let cafe = "Café 🍵"
///
/// let utf16Index = cafe.utf16.index(of: 32)!
/// let utf16Index = cafe.utf16.firstIndex(of: 32)!
/// let utf8Index = String.UTF8View.Index(utf16Index, within: cafe.utf8)!
///
/// print(Array(cafe.utf8[..<utf8Index]))