Fixes example snippets in CString.swift (#31407)

* Fixes example snippets in CString.swift

* Fixes example snippet in CString.swift
This commit is contained in:
Valeriy Van
2020-04-30 01:43:27 +02:00
committed by GitHub
parent ea293cf489
commit d30661dace

View File

@@ -76,7 +76,7 @@ extension String {
/// let s = String(validatingUTF8: ptr.baseAddress!)
/// print(s)
/// }
/// // Prints "Optional(Café)"
/// // Prints "Optional("Café")"
///
/// let invalidUTF8: [CChar] = [67, 97, 102, -61, 0]
/// invalidUTF8.withUnsafeBufferPointer { ptr in
@@ -114,7 +114,7 @@ extension String {
/// repairingInvalidCodeUnits: true)
/// print(s)
/// }
/// // Prints "Optional((Café, false))"
/// // Prints "Optional((result: "Café", repairsMade: false))"
///
/// let invalidUTF8: [UInt8] = [67, 97, 102, 195, 0]
/// invalidUTF8.withUnsafeBufferPointer { ptr in
@@ -123,7 +123,7 @@ extension String {
/// repairingInvalidCodeUnits: true)
/// print(s)
/// }
/// // Prints "Optional((Caf<EFBFBD>, true))"
/// // Prints "Optional((result: "Caf<EFBFBD>", repairsMade: true))"
///
/// - Parameters:
/// - cString: A pointer to a null-terminated code sequence encoded in