Contents

init(decodingCString:as:)

Creates a new string by copying the null-terminated sequence of code units referenced by the given pointer.

Declaration

init<Encoding>(decodingCString nullTerminatedCodeUnits: UnsafePointer<Encoding.CodeUnit>, as encoding: Encoding.Type) where Encoding : _UnicodeEncoding

Parameters

  • nullTerminatedCodeUnits:

    A pointer to a null-terminated sequence of code units encoded in encoding.

  • encoding:

    The encoding in which the code units should be interpreted.

Discussion

If nullTerminatedCodeUnits contains ill-formed code unit sequences, this initializer replaces them with the Unicode replacement character ("\u{FFFD}").