[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

@@ -26,7 +26,7 @@ extension String.Index {
/// print(cafe)
/// // Prints "Café"
///
/// let scalarsIndex = cafe.unicodeScalars.index(of: "e")!
/// let scalarsIndex = cafe.unicodeScalars.firstIndex(of: "e")!
/// let stringIndex = String.Index(scalarsIndex, within: cafe)!
///
/// print(cafe[...stringIndex])
@@ -67,7 +67,7 @@ extension String.Index {
/// uses this method find the same position in the string's `utf8` view.
///
/// let cafe = "Café"
/// if let i = cafe.index(of: "é") {
/// if let i = cafe.firstIndex(of: "é") {
/// let j = i.samePosition(in: cafe.utf8)!
/// print(Array(cafe.utf8[j...]))
/// }
@@ -96,7 +96,7 @@ extension String.Index {
/// uses this method find the same position in the string's `utf16` view.
///
/// let cafe = "Café"
/// if let i = cafe.index(of: "é") {
/// if let i = cafe.firstIndex(of: "é") {
/// let j = i.samePosition(in: cafe.utf16)!
/// print(cafe.utf16[j])
/// }