File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ extension String {
56
56
///
57
57
/// let favemoji = "My favorite emoji is 🎉"
58
58
/// if let i = favemoji.utf16.firstIndex(where: { $0 >= 128 }) {
59
- /// let asciiPrefix = String(favemoji.utf16[..<i])
59
+ /// let asciiPrefix = String(favemoji.utf16[..<i])!
60
60
/// print(asciiPrefix)
61
61
/// }
62
62
/// // Prints "My favorite emoji is "
@@ -356,7 +356,7 @@ extension String.UTF16View.Index {
356
356
/// let stringIndex = cafe.firstIndex(of: "é")!
357
357
/// let utf16Index = String.Index(stringIndex, within: cafe.utf16)!
358
358
///
359
- /// print(cafe.utf16[...utf16Index])
359
+ /// print(String( cafe.utf16[...utf16Index])! )
360
360
/// // Prints "Café"
361
361
///
362
362
/// - Parameters:
@@ -387,7 +387,7 @@ extension String.UTF16View.Index {
387
387
/// let cafe = "Café 🍵"
388
388
/// let i = cafe.utf16.firstIndex(of: 32)!
389
389
/// let j = i.samePosition(in: cafe.unicodeScalars)!
390
- /// print(cafe.unicodeScalars[..<j])
390
+ /// print(String( cafe.unicodeScalars[..<j]) )
391
391
/// // Prints "Café"
392
392
///
393
393
/// - Parameter unicodeScalars: The view to use for the index conversion.
You can’t perform that action at this time.
0 commit comments